2012-02-27 00:49:51 +00:00
|
|
|
/*!
|
2008-06-09 08:55:06 +00:00
|
|
|
* jQuery UI Effects @VERSION
|
2012-07-04 13:08:08 +00:00
|
|
|
* http://jqueryui.com
|
2008-06-06 20:08:52 +00:00
|
|
|
*
|
2022-07-19 07:36:55 +00:00
|
|
|
* Copyright OpenJS Foundation and other contributors
|
2012-08-09 14:13:24 +00:00
|
|
|
* Released under the MIT license.
|
2010-07-09 13:01:04 +00:00
|
|
|
* http://jquery.org/license
|
2008-06-06 20:08:52 +00:00
|
|
|
*/
|
2014-10-30 19:55:08 +00:00
|
|
|
|
|
|
|
//>>label: Effects Core
|
|
|
|
//>>group: Effects
|
2021-06-06 22:58:12 +00:00
|
|
|
/* eslint-disable max-len */
|
2014-10-30 19:55:08 +00:00
|
|
|
//>>description: Extends the internal jQuery effects. Includes morphing and easing. Required by all other effects.
|
2021-06-06 22:58:12 +00:00
|
|
|
/* eslint-enable max-len */
|
2014-10-30 19:55:08 +00:00
|
|
|
//>>docs: http://api.jqueryui.com/category/effects-core/
|
|
|
|
//>>demos: http://jqueryui.com/effect/
|
|
|
|
|
2015-08-21 04:12:17 +00:00
|
|
|
( function( factory ) {
|
2021-06-06 22:58:12 +00:00
|
|
|
"use strict";
|
|
|
|
|
2013-07-12 16:40:48 +00:00
|
|
|
if ( typeof define === "function" && define.amd ) {
|
|
|
|
|
|
|
|
// AMD. Register as an anonymous module.
|
2020-05-16 06:26:48 +00:00
|
|
|
define( [
|
|
|
|
"jquery",
|
2021-09-03 12:42:30 +00:00
|
|
|
"./jquery-var-for-color",
|
2020-05-16 06:26:48 +00:00
|
|
|
"./vendor/jquery-color/jquery.color",
|
|
|
|
"./version"
|
|
|
|
], factory );
|
2013-07-12 16:40:48 +00:00
|
|
|
} else {
|
|
|
|
|
|
|
|
// Browser globals
|
|
|
|
factory( jQuery );
|
|
|
|
}
|
2021-06-06 22:58:12 +00:00
|
|
|
} )( function( $ ) {
|
|
|
|
"use strict";
|
2008-05-23 09:26:18 +00:00
|
|
|
|
2014-07-14 17:18:44 +00:00
|
|
|
var dataSpace = "ui-effects-",
|
2012-12-26 13:35:42 +00:00
|
|
|
dataSpaceStyle = "ui-effects-style",
|
2021-09-03 12:42:30 +00:00
|
|
|
dataSpaceAnimated = "ui-effects-animated";
|
2011-03-15 13:00:45 +00:00
|
|
|
|
|
|
|
$.effects = {
|
|
|
|
effect: {}
|
|
|
|
};
|
2009-01-22 13:10:18 +00:00
|
|
|
|
2009-11-10 15:55:41 +00:00
|
|
|
/******************************************************************************/
|
|
|
|
/****************************** CLASS ANIMATIONS ******************************/
|
|
|
|
/******************************************************************************/
|
2015-08-21 04:12:17 +00:00
|
|
|
( function() {
|
2009-09-18 13:15:57 +00:00
|
|
|
|
2011-05-11 21:09:05 +00:00
|
|
|
var classAnimationActions = [ "add", "remove", "toggle" ],
|
2009-11-15 01:30:38 +00:00
|
|
|
shorthandStyles = {
|
|
|
|
border: 1,
|
|
|
|
borderBottom: 1,
|
|
|
|
borderColor: 1,
|
|
|
|
borderLeft: 1,
|
|
|
|
borderRight: 1,
|
|
|
|
borderTop: 1,
|
|
|
|
borderWidth: 1,
|
|
|
|
margin: 1,
|
|
|
|
padding: 1
|
2012-04-02 23:12:21 +00:00
|
|
|
};
|
2011-05-12 07:51:06 +00:00
|
|
|
|
2016-03-31 04:31:28 +00:00
|
|
|
$.each(
|
|
|
|
[ "borderLeftStyle", "borderRightStyle", "borderBottomStyle", "borderTopStyle" ],
|
|
|
|
function( _, prop ) {
|
|
|
|
$.fx.step[ prop ] = function( fx ) {
|
|
|
|
if ( fx.end !== "none" && !fx.setAttr || fx.pos === 1 && !fx.setAttr ) {
|
|
|
|
jQuery.style( fx.elem, prop, fx.end );
|
|
|
|
fx.setAttr = true;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|
|
|
|
);
|
2009-09-18 13:15:57 +00:00
|
|
|
|
2017-05-08 14:47:27 +00:00
|
|
|
function camelCase( string ) {
|
|
|
|
return string.replace( /-([\da-z])/gi, function( all, letter ) {
|
|
|
|
return letter.toUpperCase();
|
|
|
|
} );
|
|
|
|
}
|
|
|
|
|
2012-11-09 19:47:20 +00:00
|
|
|
function getElementStyles( elem ) {
|
|
|
|
var key, len,
|
|
|
|
style = elem.ownerDocument.defaultView ?
|
|
|
|
elem.ownerDocument.defaultView.getComputedStyle( elem, null ) :
|
|
|
|
elem.currentStyle,
|
|
|
|
styles = {};
|
|
|
|
|
2011-03-07 02:44:35 +00:00
|
|
|
if ( style && style.length && style[ 0 ] && style[ style[ 0 ] ] ) {
|
|
|
|
len = style.length;
|
|
|
|
while ( len-- ) {
|
|
|
|
key = style[ len ];
|
2011-05-11 21:09:05 +00:00
|
|
|
if ( typeof style[ key ] === "string" ) {
|
2017-05-08 14:47:27 +00:00
|
|
|
styles[ camelCase( key ) ] = style[ key ];
|
2009-09-18 13:15:57 +00:00
|
|
|
}
|
|
|
|
}
|
2015-08-21 04:12:17 +00:00
|
|
|
|
|
|
|
// Support: Opera, IE <9
|
2009-09-18 13:15:57 +00:00
|
|
|
} else {
|
2011-03-07 02:44:35 +00:00
|
|
|
for ( key in style ) {
|
2011-05-11 21:09:05 +00:00
|
|
|
if ( typeof style[ key ] === "string" ) {
|
2012-11-09 19:47:20 +00:00
|
|
|
styles[ key ] = style[ key ];
|
2009-09-18 13:15:57 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2011-05-11 21:09:05 +00:00
|
|
|
|
2012-11-09 19:47:20 +00:00
|
|
|
return styles;
|
2009-09-18 13:15:57 +00:00
|
|
|
}
|
|
|
|
|
2011-03-07 02:44:35 +00:00
|
|
|
function styleDifference( oldStyle, newStyle ) {
|
2011-05-11 21:09:05 +00:00
|
|
|
var diff = {},
|
|
|
|
name, value;
|
2009-09-18 13:15:57 +00:00
|
|
|
|
2011-03-07 02:44:35 +00:00
|
|
|
for ( name in newStyle ) {
|
2011-05-11 21:09:05 +00:00
|
|
|
value = newStyle[ name ];
|
2012-04-02 23:12:21 +00:00
|
|
|
if ( oldStyle[ name ] !== value ) {
|
2011-05-11 21:09:05 +00:00
|
|
|
if ( !shorthandStyles[ name ] ) {
|
|
|
|
if ( $.fx.step[ name ] || !isNaN( parseFloat( value ) ) ) {
|
|
|
|
diff[ name ] = value;
|
|
|
|
}
|
|
|
|
}
|
2009-09-18 13:15:57 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return diff;
|
|
|
|
}
|
|
|
|
|
2015-08-21 04:12:17 +00:00
|
|
|
// Support: jQuery <1.8
|
2013-01-09 02:36:34 +00:00
|
|
|
if ( !$.fn.addBack ) {
|
|
|
|
$.fn.addBack = function( selector ) {
|
|
|
|
return this.add( selector == null ?
|
|
|
|
this.prevObject : this.prevObject.filter( selector )
|
|
|
|
);
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2011-03-07 02:44:35 +00:00
|
|
|
$.effects.animateClass = function( value, duration, easing, callback ) {
|
2011-05-11 21:09:05 +00:00
|
|
|
var o = $.speed( duration, easing, callback );
|
|
|
|
|
|
|
|
return this.queue( function() {
|
|
|
|
var animated = $( this ),
|
2011-09-30 00:45:23 +00:00
|
|
|
baseClass = animated.attr( "class" ) || "",
|
2011-10-25 22:40:37 +00:00
|
|
|
applyClassChange,
|
2012-12-14 16:13:46 +00:00
|
|
|
allAnimations = o.children ? animated.find( "*" ).addBack() : animated;
|
2011-05-12 08:26:41 +00:00
|
|
|
|
2015-08-21 04:12:17 +00:00
|
|
|
// Map the animated objects to store the original styles.
|
|
|
|
allAnimations = allAnimations.map( function() {
|
2011-05-12 08:26:41 +00:00
|
|
|
var el = $( this );
|
|
|
|
return {
|
|
|
|
el: el,
|
2012-11-09 19:47:20 +00:00
|
|
|
start: getElementStyles( this )
|
2011-05-12 08:26:41 +00:00
|
|
|
};
|
2015-08-21 04:12:17 +00:00
|
|
|
} );
|
2010-12-14 14:02:00 +00:00
|
|
|
|
2015-08-21 04:12:17 +00:00
|
|
|
// Apply class change
|
2011-10-25 22:40:37 +00:00
|
|
|
applyClassChange = function() {
|
2015-08-21 04:12:17 +00:00
|
|
|
$.each( classAnimationActions, function( i, action ) {
|
2011-10-25 22:40:37 +00:00
|
|
|
if ( value[ action ] ) {
|
|
|
|
animated[ action + "Class" ]( value[ action ] );
|
|
|
|
}
|
2015-08-21 04:12:17 +00:00
|
|
|
} );
|
2011-10-25 22:40:37 +00:00
|
|
|
};
|
|
|
|
applyClassChange();
|
2011-05-12 08:26:41 +00:00
|
|
|
|
2015-08-21 04:12:17 +00:00
|
|
|
// Map all animated objects again - calculate new styles and diff
|
|
|
|
allAnimations = allAnimations.map( function() {
|
2012-11-09 19:47:20 +00:00
|
|
|
this.end = getElementStyles( this.el[ 0 ] );
|
2011-05-12 08:26:41 +00:00
|
|
|
this.diff = styleDifference( this.start, this.end );
|
|
|
|
return this;
|
2015-08-21 04:12:17 +00:00
|
|
|
} );
|
2011-05-12 08:26:41 +00:00
|
|
|
|
2015-08-21 04:12:17 +00:00
|
|
|
// Apply original class
|
2011-05-11 21:09:05 +00:00
|
|
|
animated.attr( "class", baseClass );
|
|
|
|
|
2015-08-21 04:12:17 +00:00
|
|
|
// Map all animated objects again - this time collecting a promise
|
|
|
|
allAnimations = allAnimations.map( function() {
|
2011-05-12 08:26:41 +00:00
|
|
|
var styleInfo = this,
|
2012-04-30 05:19:52 +00:00
|
|
|
dfd = $.Deferred(),
|
2015-08-21 04:12:17 +00:00
|
|
|
opts = $.extend( {}, o, {
|
2012-04-30 05:19:52 +00:00
|
|
|
queue: false,
|
|
|
|
complete: function() {
|
2012-04-30 06:05:30 +00:00
|
|
|
dfd.resolve( styleInfo );
|
2012-04-30 05:19:52 +00:00
|
|
|
}
|
2015-08-21 04:12:17 +00:00
|
|
|
} );
|
2012-04-30 05:19:52 +00:00
|
|
|
|
|
|
|
this.el.animate( this.diff, opts );
|
2011-05-12 08:26:41 +00:00
|
|
|
return dfd.promise();
|
2015-08-21 04:12:17 +00:00
|
|
|
} );
|
2011-05-12 08:26:41 +00:00
|
|
|
|
2015-08-21 04:12:17 +00:00
|
|
|
// Once all animations have completed:
|
|
|
|
$.when.apply( $, allAnimations.get() ).done( function() {
|
2011-05-12 08:26:41 +00:00
|
|
|
|
2015-08-21 04:12:17 +00:00
|
|
|
// Set the final class
|
2011-10-25 22:40:37 +00:00
|
|
|
applyClassChange();
|
2011-05-12 08:26:41 +00:00
|
|
|
|
2015-08-21 04:12:17 +00:00
|
|
|
// For each animated element,
|
2011-10-25 22:40:37 +00:00
|
|
|
// clear all css properties that were animated
|
2011-05-12 08:26:41 +00:00
|
|
|
$.each( arguments, function() {
|
2011-10-25 22:40:37 +00:00
|
|
|
var el = this.el;
|
2015-08-21 04:12:17 +00:00
|
|
|
$.each( this.diff, function( key ) {
|
2012-12-25 17:01:09 +00:00
|
|
|
el.css( key, "" );
|
2015-08-21 04:12:17 +00:00
|
|
|
} );
|
|
|
|
} );
|
2011-05-12 08:26:41 +00:00
|
|
|
|
2015-08-21 04:12:17 +00:00
|
|
|
// This is guarnteed to be there if you use jQuery.speed()
|
2011-05-12 08:26:41 +00:00
|
|
|
// it also handles dequeuing the next anim...
|
|
|
|
o.complete.call( animated[ 0 ] );
|
2015-08-21 04:12:17 +00:00
|
|
|
} );
|
|
|
|
} );
|
2009-11-10 15:55:41 +00:00
|
|
|
};
|
|
|
|
|
2015-08-21 04:12:17 +00:00
|
|
|
$.fn.extend( {
|
|
|
|
addClass: ( function( orig ) {
|
2013-03-08 15:23:25 +00:00
|
|
|
return function( classNames, speed, easing, callback ) {
|
|
|
|
return speed ?
|
|
|
|
$.effects.animateClass.call( this,
|
|
|
|
{ add: classNames }, speed, easing, callback ) :
|
|
|
|
orig.apply( this, arguments );
|
|
|
|
};
|
2015-08-21 04:12:17 +00:00
|
|
|
} )( $.fn.addClass ),
|
2013-03-08 15:23:25 +00:00
|
|
|
|
2015-08-21 04:12:17 +00:00
|
|
|
removeClass: ( function( orig ) {
|
2013-03-08 15:23:25 +00:00
|
|
|
return function( classNames, speed, easing, callback ) {
|
|
|
|
return arguments.length > 1 ?
|
|
|
|
$.effects.animateClass.call( this,
|
|
|
|
{ remove: classNames }, speed, easing, callback ) :
|
|
|
|
orig.apply( this, arguments );
|
|
|
|
};
|
2015-08-21 04:12:17 +00:00
|
|
|
} )( $.fn.removeClass ),
|
2013-03-08 15:23:25 +00:00
|
|
|
|
2015-08-21 04:12:17 +00:00
|
|
|
toggleClass: ( function( orig ) {
|
2013-03-08 15:23:25 +00:00
|
|
|
return function( classNames, force, speed, easing, callback ) {
|
|
|
|
if ( typeof force === "boolean" || force === undefined ) {
|
|
|
|
if ( !speed ) {
|
2015-08-21 04:12:17 +00:00
|
|
|
|
|
|
|
// Without speed parameter
|
2013-03-08 15:23:25 +00:00
|
|
|
return orig.apply( this, arguments );
|
|
|
|
} else {
|
|
|
|
return $.effects.animateClass.call( this,
|
2015-08-21 04:12:17 +00:00
|
|
|
( force ? { add: classNames } : { remove: classNames } ),
|
2013-03-08 15:23:25 +00:00
|
|
|
speed, easing, callback );
|
|
|
|
}
|
2009-11-10 15:55:41 +00:00
|
|
|
} else {
|
2015-08-21 04:12:17 +00:00
|
|
|
|
|
|
|
// Without force parameter
|
2012-08-27 21:23:30 +00:00
|
|
|
return $.effects.animateClass.call( this,
|
2013-03-08 15:23:25 +00:00
|
|
|
{ toggle: classNames }, force, speed, easing );
|
2009-11-10 15:55:41 +00:00
|
|
|
}
|
2013-03-08 15:23:25 +00:00
|
|
|
};
|
2015-08-21 04:12:17 +00:00
|
|
|
} )( $.fn.toggleClass ),
|
2009-11-10 15:55:41 +00:00
|
|
|
|
2015-08-21 04:12:17 +00:00
|
|
|
switchClass: function( remove, add, speed, easing, callback ) {
|
2012-08-27 21:23:30 +00:00
|
|
|
return $.effects.animateClass.call( this, {
|
|
|
|
add: add,
|
|
|
|
remove: remove
|
|
|
|
}, speed, easing, callback );
|
2009-11-15 01:30:38 +00:00
|
|
|
}
|
2015-08-21 04:12:17 +00:00
|
|
|
} );
|
2009-11-10 15:55:41 +00:00
|
|
|
|
2015-08-21 04:12:17 +00:00
|
|
|
} )();
|
2009-11-10 15:55:41 +00:00
|
|
|
|
|
|
|
/******************************************************************************/
|
|
|
|
/*********************************** EFFECTS **********************************/
|
|
|
|
/******************************************************************************/
|
|
|
|
|
2015-08-21 04:12:17 +00:00
|
|
|
( function() {
|
2012-04-02 23:12:21 +00:00
|
|
|
|
2019-12-08 21:27:16 +00:00
|
|
|
if ( $.expr && $.expr.pseudos && $.expr.pseudos.animated ) {
|
|
|
|
$.expr.pseudos.animated = ( function( orig ) {
|
2012-12-26 13:35:42 +00:00
|
|
|
return function( elem ) {
|
|
|
|
return !!$( elem ).data( dataSpaceAnimated ) || orig( elem );
|
|
|
|
};
|
2019-12-08 21:27:16 +00:00
|
|
|
} )( $.expr.pseudos.animated );
|
2012-12-26 13:35:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if ( $.uiBackCompat !== false ) {
|
|
|
|
$.extend( $.effects, {
|
2015-08-21 04:12:17 +00:00
|
|
|
|
2012-12-26 13:35:42 +00:00
|
|
|
// Saves a set of properties in a data storage
|
|
|
|
save: function( element, set ) {
|
|
|
|
var i = 0, length = set.length;
|
|
|
|
for ( ; i < length; i++ ) {
|
|
|
|
if ( set[ i ] !== null ) {
|
|
|
|
element.data( dataSpace + set[ i ], element[ 0 ].style[ set[ i ] ] );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
// Restores a set of previously saved properties from a data storage
|
|
|
|
restore: function( element, set ) {
|
|
|
|
var val, i = 0, length = set.length;
|
|
|
|
for ( ; i < length; i++ ) {
|
|
|
|
if ( set[ i ] !== null ) {
|
|
|
|
val = element.data( dataSpace + set[ i ] );
|
|
|
|
element.css( set[ i ], val );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
setMode: function( el, mode ) {
|
|
|
|
if ( mode === "toggle" ) {
|
|
|
|
mode = el.is( ":hidden" ) ? "show" : "hide";
|
|
|
|
}
|
|
|
|
return mode;
|
|
|
|
},
|
|
|
|
|
|
|
|
// Wraps the element around a wrapper that copies position properties
|
|
|
|
createWrapper: function( element ) {
|
|
|
|
|
2015-08-21 04:12:17 +00:00
|
|
|
// If the element is already wrapped, return it
|
2012-12-26 13:35:42 +00:00
|
|
|
if ( element.parent().is( ".ui-effects-wrapper" ) ) {
|
|
|
|
return element.parent();
|
|
|
|
}
|
|
|
|
|
2015-08-21 04:12:17 +00:00
|
|
|
// Wrap the element
|
2012-12-26 13:35:42 +00:00
|
|
|
var props = {
|
|
|
|
width: element.outerWidth( true ),
|
|
|
|
height: element.outerHeight( true ),
|
|
|
|
"float": element.css( "float" )
|
|
|
|
},
|
|
|
|
wrapper = $( "<div></div>" )
|
|
|
|
.addClass( "ui-effects-wrapper" )
|
2015-08-21 04:12:17 +00:00
|
|
|
.css( {
|
2012-12-26 13:35:42 +00:00
|
|
|
fontSize: "100%",
|
|
|
|
background: "transparent",
|
|
|
|
border: "none",
|
|
|
|
margin: 0,
|
|
|
|
padding: 0
|
2015-08-21 04:12:17 +00:00
|
|
|
} ),
|
|
|
|
|
2012-12-26 13:35:42 +00:00
|
|
|
// Store the size in case width/height are defined in % - Fixes #5245
|
|
|
|
size = {
|
|
|
|
width: element.width(),
|
|
|
|
height: element.height()
|
|
|
|
},
|
|
|
|
active = document.activeElement;
|
|
|
|
|
2015-08-21 04:12:17 +00:00
|
|
|
// Support: Firefox
|
2012-12-26 13:35:42 +00:00
|
|
|
// Firefox incorrectly exposes anonymous content
|
|
|
|
// https://bugzilla.mozilla.org/show_bug.cgi?id=561664
|
|
|
|
try {
|
2021-06-06 22:58:12 +00:00
|
|
|
// eslint-disable-next-line no-unused-expressions
|
2012-12-26 13:35:42 +00:00
|
|
|
active.id;
|
|
|
|
} catch ( e ) {
|
|
|
|
active = document.body;
|
|
|
|
}
|
|
|
|
|
|
|
|
element.wrap( wrapper );
|
|
|
|
|
|
|
|
// Fixes #7595 - Elements lose focus when wrapped.
|
|
|
|
if ( element[ 0 ] === active || $.contains( element[ 0 ], active ) ) {
|
2015-05-14 02:02:48 +00:00
|
|
|
$( active ).trigger( "focus" );
|
2012-12-26 13:35:42 +00:00
|
|
|
}
|
|
|
|
|
2016-03-31 04:31:28 +00:00
|
|
|
// Hotfix for jQuery 1.4 since some change in wrap() seems to actually
|
|
|
|
// lose the reference to the wrapped element
|
|
|
|
wrapper = element.parent();
|
2012-12-26 13:35:42 +00:00
|
|
|
|
2015-08-21 04:12:17 +00:00
|
|
|
// Transfer positioning properties to the wrapper
|
2012-12-26 13:35:42 +00:00
|
|
|
if ( element.css( "position" ) === "static" ) {
|
2015-08-21 04:12:17 +00:00
|
|
|
wrapper.css( { position: "relative" } );
|
|
|
|
element.css( { position: "relative" } );
|
2012-12-26 13:35:42 +00:00
|
|
|
} else {
|
|
|
|
$.extend( props, {
|
|
|
|
position: element.css( "position" ),
|
|
|
|
zIndex: element.css( "z-index" )
|
2015-08-21 04:12:17 +00:00
|
|
|
} );
|
|
|
|
$.each( [ "top", "left", "bottom", "right" ], function( i, pos ) {
|
2012-12-26 13:35:42 +00:00
|
|
|
props[ pos ] = element.css( pos );
|
|
|
|
if ( isNaN( parseInt( props[ pos ], 10 ) ) ) {
|
|
|
|
props[ pos ] = "auto";
|
|
|
|
}
|
2015-08-21 04:12:17 +00:00
|
|
|
} );
|
|
|
|
element.css( {
|
2012-12-26 13:35:42 +00:00
|
|
|
position: "relative",
|
|
|
|
top: 0,
|
|
|
|
left: 0,
|
|
|
|
right: "auto",
|
|
|
|
bottom: "auto"
|
2015-08-21 04:12:17 +00:00
|
|
|
} );
|
2012-12-26 13:35:42 +00:00
|
|
|
}
|
2015-08-21 04:12:17 +00:00
|
|
|
element.css( size );
|
2012-12-26 13:35:42 +00:00
|
|
|
|
|
|
|
return wrapper.css( props ).show();
|
|
|
|
},
|
|
|
|
|
|
|
|
removeWrapper: function( element ) {
|
|
|
|
var active = document.activeElement;
|
|
|
|
|
|
|
|
if ( element.parent().is( ".ui-effects-wrapper" ) ) {
|
|
|
|
element.parent().replaceWith( element );
|
|
|
|
|
|
|
|
// Fixes #7595 - Elements lose focus when wrapped.
|
|
|
|
if ( element[ 0 ] === active || $.contains( element[ 0 ], active ) ) {
|
2015-05-14 02:02:48 +00:00
|
|
|
$( active ).trigger( "focus" );
|
2012-12-26 13:35:42 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return element;
|
|
|
|
}
|
2015-08-21 04:12:17 +00:00
|
|
|
} );
|
2012-12-26 13:35:42 +00:00
|
|
|
}
|
|
|
|
|
2011-03-07 02:44:35 +00:00
|
|
|
$.extend( $.effects, {
|
2009-11-10 15:55:41 +00:00
|
|
|
version: "@VERSION",
|
|
|
|
|
2012-12-26 13:35:42 +00:00
|
|
|
define: function( name, mode, effect ) {
|
|
|
|
if ( !effect ) {
|
|
|
|
effect = mode;
|
|
|
|
mode = "effect";
|
2009-11-10 15:55:41 +00:00
|
|
|
}
|
2012-12-26 13:35:42 +00:00
|
|
|
|
|
|
|
$.effects.effect[ name ] = effect;
|
|
|
|
$.effects.effect[ name ].mode = mode;
|
|
|
|
|
|
|
|
return effect;
|
2009-11-10 15:55:41 +00:00
|
|
|
},
|
|
|
|
|
2012-12-26 13:35:42 +00:00
|
|
|
scaledDimensions: function( element, percent, direction ) {
|
|
|
|
if ( percent === 0 ) {
|
|
|
|
return {
|
|
|
|
height: 0,
|
|
|
|
width: 0,
|
|
|
|
outerHeight: 0,
|
|
|
|
outerWidth: 0
|
|
|
|
};
|
2009-11-10 15:55:41 +00:00
|
|
|
}
|
2012-12-26 13:35:42 +00:00
|
|
|
|
|
|
|
var x = direction !== "horizontal" ? ( ( percent || 100 ) / 100 ) : 1,
|
|
|
|
y = direction !== "vertical" ? ( ( percent || 100 ) / 100 ) : 1;
|
|
|
|
|
|
|
|
return {
|
|
|
|
height: element.height() * y,
|
|
|
|
width: element.width() * x,
|
|
|
|
outerHeight: element.outerHeight() * y,
|
|
|
|
outerWidth: element.outerWidth() * x
|
|
|
|
};
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
clipToBox: function( animation ) {
|
|
|
|
return {
|
|
|
|
width: animation.clip.right - animation.clip.left,
|
|
|
|
height: animation.clip.bottom - animation.clip.top,
|
|
|
|
left: animation.clip.left,
|
|
|
|
top: animation.clip.top
|
|
|
|
};
|
|
|
|
},
|
|
|
|
|
|
|
|
// Injects recently queued functions to be first in line (after "inprogress")
|
|
|
|
unshift: function( element, queueLength, count ) {
|
|
|
|
var queue = element.queue();
|
|
|
|
|
|
|
|
if ( queueLength > 1 ) {
|
|
|
|
queue.splice.apply( queue,
|
|
|
|
[ 1, 0 ].concat( queue.splice( queueLength, count ) ) );
|
|
|
|
}
|
|
|
|
element.dequeue();
|
|
|
|
},
|
|
|
|
|
|
|
|
saveStyle: function( element ) {
|
|
|
|
element.data( dataSpaceStyle, element[ 0 ].style.cssText );
|
|
|
|
},
|
|
|
|
|
|
|
|
restoreStyle: function( element ) {
|
|
|
|
element[ 0 ].style.cssText = element.data( dataSpaceStyle ) || "";
|
|
|
|
element.removeData( dataSpaceStyle );
|
2009-11-10 15:55:41 +00:00
|
|
|
},
|
|
|
|
|
2012-12-26 13:35:42 +00:00
|
|
|
mode: function( element, mode ) {
|
|
|
|
var hidden = element.is( ":hidden" );
|
|
|
|
|
|
|
|
if ( mode === "toggle" ) {
|
|
|
|
mode = hidden ? "show" : "hide";
|
|
|
|
}
|
|
|
|
if ( hidden ? mode === "hide" : mode === "show" ) {
|
|
|
|
mode = "none";
|
2011-03-07 02:44:35 +00:00
|
|
|
}
|
2009-11-10 15:55:41 +00:00
|
|
|
return mode;
|
|
|
|
},
|
|
|
|
|
2011-03-07 02:44:35 +00:00
|
|
|
// Translates a [top,left] array into a baseline value
|
2011-05-12 07:51:06 +00:00
|
|
|
getBaseline: function( origin, original ) {
|
2009-11-10 15:55:41 +00:00
|
|
|
var y, x;
|
2012-12-26 13:35:42 +00:00
|
|
|
|
2011-03-07 02:44:35 +00:00
|
|
|
switch ( origin[ 0 ] ) {
|
2012-12-26 13:35:42 +00:00
|
|
|
case "top":
|
|
|
|
y = 0;
|
|
|
|
break;
|
|
|
|
case "middle":
|
|
|
|
y = 0.5;
|
|
|
|
break;
|
|
|
|
case "bottom":
|
|
|
|
y = 1;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
y = origin[ 0 ] / original.height;
|
2012-04-02 19:55:50 +00:00
|
|
|
}
|
2012-12-26 13:35:42 +00:00
|
|
|
|
2011-03-07 02:44:35 +00:00
|
|
|
switch ( origin[ 1 ] ) {
|
2012-12-26 13:35:42 +00:00
|
|
|
case "left":
|
|
|
|
x = 0;
|
|
|
|
break;
|
|
|
|
case "center":
|
|
|
|
x = 0.5;
|
|
|
|
break;
|
|
|
|
case "right":
|
|
|
|
x = 1;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
x = origin[ 1 ] / original.width;
|
2012-04-02 19:55:50 +00:00
|
|
|
}
|
2012-12-26 13:35:42 +00:00
|
|
|
|
2011-03-07 02:44:35 +00:00
|
|
|
return {
|
|
|
|
x: x,
|
|
|
|
y: y
|
2009-11-10 15:55:41 +00:00
|
|
|
};
|
|
|
|
},
|
|
|
|
|
2012-12-26 13:35:42 +00:00
|
|
|
// Creates a placeholder element so that the original element can be made absolute
|
|
|
|
createPlaceholder: function( element ) {
|
|
|
|
var placeholder,
|
|
|
|
cssPosition = element.css( "position" ),
|
|
|
|
position = element.position();
|
|
|
|
|
|
|
|
// Lock in margins first to account for form elements, which
|
|
|
|
// will change margin if you explicitly set height
|
|
|
|
// see: http://jsfiddle.net/JZSMt/3/ https://bugs.webkit.org/show_bug.cgi?id=107380
|
|
|
|
// Support: Safari
|
2015-08-21 04:12:17 +00:00
|
|
|
element.css( {
|
2012-12-26 13:35:42 +00:00
|
|
|
marginTop: element.css( "marginTop" ),
|
|
|
|
marginBottom: element.css( "marginBottom" ),
|
|
|
|
marginLeft: element.css( "marginLeft" ),
|
|
|
|
marginRight: element.css( "marginRight" )
|
2015-08-21 04:12:17 +00:00
|
|
|
} )
|
2012-12-26 13:35:42 +00:00
|
|
|
.outerWidth( element.outerWidth() )
|
|
|
|
.outerHeight( element.outerHeight() );
|
|
|
|
|
|
|
|
if ( /^(static|relative)/.test( cssPosition ) ) {
|
|
|
|
cssPosition = "absolute";
|
|
|
|
|
2015-08-21 04:12:17 +00:00
|
|
|
placeholder = $( "<" + element[ 0 ].nodeName + ">" ).insertAfter( element ).css( {
|
2012-12-26 13:35:42 +00:00
|
|
|
|
|
|
|
// Convert inline to inline block to account for inline elements
|
|
|
|
// that turn to inline block based on content (like img)
|
2016-03-31 04:31:28 +00:00
|
|
|
display: /^(inline|ruby)/.test( element.css( "display" ) ) ?
|
|
|
|
"inline-block" :
|
|
|
|
"block",
|
2012-12-26 13:35:42 +00:00
|
|
|
visibility: "hidden",
|
|
|
|
|
|
|
|
// Margins need to be set to account for margin collapse
|
|
|
|
marginTop: element.css( "marginTop" ),
|
|
|
|
marginBottom: element.css( "marginBottom" ),
|
|
|
|
marginLeft: element.css( "marginLeft" ),
|
|
|
|
marginRight: element.css( "marginRight" ),
|
2011-05-12 07:51:06 +00:00
|
|
|
"float": element.css( "float" )
|
2015-08-21 04:12:17 +00:00
|
|
|
} )
|
2012-12-26 13:35:42 +00:00
|
|
|
.outerWidth( element.outerWidth() )
|
|
|
|
.outerHeight( element.outerHeight() )
|
|
|
|
.addClass( "ui-effects-placeholder" );
|
2012-05-07 14:32:42 +00:00
|
|
|
|
2012-12-26 13:35:42 +00:00
|
|
|
element.data( dataSpace + "placeholder", placeholder );
|
2011-08-02 21:54:24 +00:00
|
|
|
}
|
|
|
|
|
2015-08-21 04:12:17 +00:00
|
|
|
element.css( {
|
2012-12-26 13:35:42 +00:00
|
|
|
position: cssPosition,
|
|
|
|
left: position.left,
|
|
|
|
top: position.top
|
2015-08-21 04:12:17 +00:00
|
|
|
} );
|
2009-11-10 15:55:41 +00:00
|
|
|
|
2012-12-26 13:35:42 +00:00
|
|
|
return placeholder;
|
2009-11-10 15:55:41 +00:00
|
|
|
},
|
|
|
|
|
2012-12-26 13:35:42 +00:00
|
|
|
removePlaceholder: function( element ) {
|
|
|
|
var dataKey = dataSpace + "placeholder",
|
|
|
|
placeholder = element.data( dataKey );
|
2011-08-02 21:54:24 +00:00
|
|
|
|
2012-12-26 13:35:42 +00:00
|
|
|
if ( placeholder ) {
|
|
|
|
placeholder.remove();
|
|
|
|
element.removeData( dataKey );
|
2011-08-02 21:54:24 +00:00
|
|
|
}
|
2012-12-26 13:35:42 +00:00
|
|
|
},
|
2011-08-02 21:54:24 +00:00
|
|
|
|
2012-12-26 13:35:42 +00:00
|
|
|
// Removes a placeholder if it exists and restores
|
|
|
|
// properties that were modified during placeholder creation
|
|
|
|
cleanUp: function( element ) {
|
|
|
|
$.effects.restoreStyle( element );
|
|
|
|
$.effects.removePlaceholder( element );
|
2009-11-10 15:55:41 +00:00
|
|
|
},
|
|
|
|
|
2011-03-07 02:44:35 +00:00
|
|
|
setTransition: function( element, list, factor, value ) {
|
2009-11-10 15:55:41 +00:00
|
|
|
value = value || {};
|
2012-04-02 23:12:21 +00:00
|
|
|
$.each( list, function( i, x ) {
|
2011-05-18 23:13:37 +00:00
|
|
|
var unit = element.cssUnit( x );
|
2012-04-02 23:12:21 +00:00
|
|
|
if ( unit[ 0 ] > 0 ) {
|
|
|
|
value[ x ] = unit[ 0 ] * factor + unit[ 1 ];
|
|
|
|
}
|
2015-08-21 04:12:17 +00:00
|
|
|
} );
|
2009-11-10 15:55:41 +00:00
|
|
|
return value;
|
|
|
|
}
|
2015-08-21 04:12:17 +00:00
|
|
|
} );
|
2009-11-10 15:55:41 +00:00
|
|
|
|
2015-08-21 04:12:17 +00:00
|
|
|
// Return an effect options object for the given parameters:
|
2011-03-03 01:30:27 +00:00
|
|
|
function _normalizeArguments( effect, options, speed, callback ) {
|
2009-01-29 13:34:58 +00:00
|
|
|
|
2015-08-21 04:12:17 +00:00
|
|
|
// Allow passing all options as the first parameter
|
2011-03-03 01:30:27 +00:00
|
|
|
if ( $.isPlainObject( effect ) ) {
|
2012-04-03 02:35:42 +00:00
|
|
|
options = effect;
|
|
|
|
effect = effect.effect;
|
2009-07-13 00:51:03 +00:00
|
|
|
}
|
2011-03-03 01:30:27 +00:00
|
|
|
|
2015-08-21 04:12:17 +00:00
|
|
|
// Convert to an object
|
2011-03-03 02:58:10 +00:00
|
|
|
effect = { effect: effect };
|
|
|
|
|
2015-08-21 04:12:17 +00:00
|
|
|
// Catch (effect, null, ...)
|
2012-10-21 21:46:38 +00:00
|
|
|
if ( options == null ) {
|
2011-03-09 15:09:29 +00:00
|
|
|
options = {};
|
|
|
|
}
|
|
|
|
|
2015-08-21 04:12:17 +00:00
|
|
|
// Catch (effect, callback)
|
2019-12-08 21:23:08 +00:00
|
|
|
if ( typeof options === "function" ) {
|
2009-06-10 01:22:38 +00:00
|
|
|
callback = options;
|
|
|
|
speed = null;
|
|
|
|
options = {};
|
|
|
|
}
|
2011-03-03 02:58:10 +00:00
|
|
|
|
2015-08-21 04:12:17 +00:00
|
|
|
// Catch (effect, speed, ?)
|
2012-04-03 02:35:42 +00:00
|
|
|
if ( typeof options === "number" || $.fx.speeds[ options ] ) {
|
2009-06-10 01:22:38 +00:00
|
|
|
callback = speed;
|
|
|
|
speed = options;
|
|
|
|
options = {};
|
|
|
|
}
|
2011-03-03 02:58:10 +00:00
|
|
|
|
2015-08-21 04:12:17 +00:00
|
|
|
// Catch (effect, options, callback)
|
2019-12-08 21:23:08 +00:00
|
|
|
if ( typeof speed === "function" ) {
|
2010-06-16 11:38:19 +00:00
|
|
|
callback = speed;
|
|
|
|
speed = null;
|
|
|
|
}
|
2009-06-10 01:22:38 +00:00
|
|
|
|
2015-08-21 04:12:17 +00:00
|
|
|
// Add options to effect
|
2011-03-03 01:30:27 +00:00
|
|
|
if ( options ) {
|
2011-03-03 02:58:10 +00:00
|
|
|
$.extend( effect, options );
|
2011-03-03 01:30:27 +00:00
|
|
|
}
|
2011-05-12 07:51:06 +00:00
|
|
|
|
2009-06-10 01:22:38 +00:00
|
|
|
speed = speed || options.duration;
|
2012-04-02 19:55:50 +00:00
|
|
|
effect.duration = $.fx.off ? 0 :
|
|
|
|
typeof speed === "number" ? speed :
|
|
|
|
speed in $.fx.speeds ? $.fx.speeds[ speed ] :
|
|
|
|
$.fx.speeds._default;
|
2009-01-29 13:34:58 +00:00
|
|
|
|
2011-03-03 02:58:10 +00:00
|
|
|
effect.complete = callback || options.complete;
|
2009-06-10 01:22:38 +00:00
|
|
|
|
2011-03-03 02:58:10 +00:00
|
|
|
return effect;
|
2009-01-29 13:34:58 +00:00
|
|
|
}
|
|
|
|
|
2013-02-28 18:34:49 +00:00
|
|
|
function standardAnimationOption( option ) {
|
2015-08-21 04:12:17 +00:00
|
|
|
|
2013-02-28 18:34:49 +00:00
|
|
|
// Valid standard speeds (nothing, number, named speed)
|
|
|
|
if ( !option || typeof option === "number" || $.fx.speeds[ option ] ) {
|
2010-09-20 14:07:45 +00:00
|
|
|
return true;
|
|
|
|
}
|
2011-05-12 07:51:06 +00:00
|
|
|
|
2013-02-28 18:34:49 +00:00
|
|
|
// Invalid strings - treat as "normal" speed
|
|
|
|
if ( typeof option === "string" && !$.effects.effect[ option ] ) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Complete callback
|
2019-12-08 21:23:08 +00:00
|
|
|
if ( typeof option === "function" ) {
|
2013-02-28 18:34:49 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Options hash (but not naming an effect)
|
|
|
|
if ( typeof option === "object" && !option.effect ) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Didn't match any standard API
|
|
|
|
return false;
|
2010-09-20 14:07:45 +00:00
|
|
|
}
|
|
|
|
|
2015-08-21 04:12:17 +00:00
|
|
|
$.fn.extend( {
|
2012-10-23 14:36:42 +00:00
|
|
|
effect: function( /* effect, options, speed, callback */ ) {
|
2011-03-07 02:44:35 +00:00
|
|
|
var args = _normalizeArguments.apply( this, arguments ),
|
2012-12-26 13:35:42 +00:00
|
|
|
effectMethod = $.effects.effect[ args.effect ],
|
|
|
|
defaultMode = effectMethod.mode,
|
2011-06-21 05:23:52 +00:00
|
|
|
queue = args.queue,
|
2012-12-26 13:35:42 +00:00
|
|
|
queueName = queue || "fx",
|
|
|
|
complete = args.complete,
|
|
|
|
mode = args.mode,
|
|
|
|
modes = [],
|
|
|
|
prefilter = function( next ) {
|
|
|
|
var el = $( this ),
|
|
|
|
normalizedMode = $.effects.mode( el, mode ) || defaultMode;
|
|
|
|
|
2016-12-15 16:27:39 +00:00
|
|
|
// Sentinel for duck-punching the :animated pseudo-selector
|
2012-12-26 13:35:42 +00:00
|
|
|
el.data( dataSpaceAnimated, true );
|
|
|
|
|
|
|
|
// Save effect mode for later use,
|
|
|
|
// we can't just call $.effects.mode again later,
|
|
|
|
// as the .show() below destroys the initial state
|
|
|
|
modes.push( normalizedMode );
|
|
|
|
|
2021-08-26 11:36:06 +00:00
|
|
|
// See $.uiBackCompat inside of run() for removal of defaultMode in 1.14
|
2012-12-26 13:35:42 +00:00
|
|
|
if ( defaultMode && ( normalizedMode === "show" ||
|
|
|
|
( normalizedMode === defaultMode && normalizedMode === "hide" ) ) ) {
|
|
|
|
el.show();
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( !defaultMode || normalizedMode !== "none" ) {
|
|
|
|
$.effects.saveStyle( el );
|
|
|
|
}
|
|
|
|
|
2019-12-08 21:23:08 +00:00
|
|
|
if ( typeof next === "function" ) {
|
2012-12-26 13:35:42 +00:00
|
|
|
next();
|
|
|
|
}
|
|
|
|
};
|
2011-03-15 13:00:45 +00:00
|
|
|
|
2012-10-25 13:25:40 +00:00
|
|
|
if ( $.fx.off || !effectMethod ) {
|
2015-08-21 04:12:17 +00:00
|
|
|
|
|
|
|
// Delegate to the original method (e.g., .show()) if possible
|
2010-10-04 18:52:06 +00:00
|
|
|
if ( mode ) {
|
2012-12-26 13:35:42 +00:00
|
|
|
return this[ mode ]( args.duration, complete );
|
2010-10-04 18:52:06 +00:00
|
|
|
} else {
|
2011-03-07 02:44:35 +00:00
|
|
|
return this.each( function() {
|
2012-12-26 13:35:42 +00:00
|
|
|
if ( complete ) {
|
|
|
|
complete.call( this );
|
2010-10-04 18:52:06 +00:00
|
|
|
}
|
2015-08-21 04:12:17 +00:00
|
|
|
} );
|
2010-10-04 18:52:06 +00:00
|
|
|
}
|
|
|
|
}
|
2011-03-15 13:00:45 +00:00
|
|
|
|
2011-06-21 05:23:52 +00:00
|
|
|
function run( next ) {
|
2012-12-26 13:35:42 +00:00
|
|
|
var elem = $( this );
|
|
|
|
|
|
|
|
function cleanup() {
|
|
|
|
elem.removeData( dataSpaceAnimated );
|
|
|
|
|
|
|
|
$.effects.cleanUp( elem );
|
|
|
|
|
|
|
|
if ( args.mode === "hide" ) {
|
|
|
|
elem.hide();
|
|
|
|
}
|
|
|
|
|
|
|
|
done();
|
|
|
|
}
|
2011-06-21 06:11:46 +00:00
|
|
|
|
|
|
|
function done() {
|
2019-12-08 21:23:08 +00:00
|
|
|
if ( typeof complete === "function" ) {
|
2012-12-26 13:35:42 +00:00
|
|
|
complete.call( elem[ 0 ] );
|
2011-06-21 06:11:46 +00:00
|
|
|
}
|
2012-12-26 13:35:42 +00:00
|
|
|
|
2019-12-08 21:23:08 +00:00
|
|
|
if ( typeof next === "function" ) {
|
2011-06-21 06:11:46 +00:00
|
|
|
next();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-12-26 13:35:42 +00:00
|
|
|
// Override mode option on a per element basis,
|
|
|
|
// as toggle can be either show or hide depending on element state
|
|
|
|
args.mode = modes.shift();
|
|
|
|
|
|
|
|
if ( $.uiBackCompat !== false && !defaultMode ) {
|
|
|
|
if ( elem.is( ":hidden" ) ? mode === "hide" : mode === "show" ) {
|
|
|
|
|
|
|
|
// Call the core method to track "olddisplay" properly
|
|
|
|
elem[ mode ]();
|
|
|
|
done();
|
|
|
|
} else {
|
|
|
|
effectMethod.call( elem[ 0 ], args, done );
|
|
|
|
}
|
2011-06-23 12:22:34 +00:00
|
|
|
} else {
|
2012-12-26 13:35:42 +00:00
|
|
|
if ( args.mode === "none" ) {
|
|
|
|
|
|
|
|
// Call the core method to track "olddisplay" properly
|
|
|
|
elem[ mode ]();
|
|
|
|
done();
|
|
|
|
} else {
|
|
|
|
effectMethod.call( elem[ 0 ], args, cleanup );
|
|
|
|
}
|
2011-06-23 12:22:34 +00:00
|
|
|
}
|
2011-06-21 05:23:52 +00:00
|
|
|
}
|
|
|
|
|
2012-12-26 13:35:42 +00:00
|
|
|
// Run prefilter on all elements first to ensure that
|
|
|
|
// any showing or hiding happens before placeholder creation,
|
|
|
|
// which ensures that any layout changes are correctly captured.
|
|
|
|
return queue === false ?
|
|
|
|
this.each( prefilter ).each( run ) :
|
|
|
|
this.queue( queueName, prefilter ).queue( queueName, run );
|
2008-06-06 19:47:31 +00:00
|
|
|
},
|
2009-01-22 13:10:18 +00:00
|
|
|
|
2015-08-21 04:12:17 +00:00
|
|
|
show: ( function( orig ) {
|
2013-02-28 18:34:49 +00:00
|
|
|
return function( option ) {
|
|
|
|
if ( standardAnimationOption( option ) ) {
|
|
|
|
return orig.apply( this, arguments );
|
|
|
|
} else {
|
|
|
|
var args = _normalizeArguments.apply( this, arguments );
|
|
|
|
args.mode = "show";
|
|
|
|
return this.effect.call( this, args );
|
|
|
|
}
|
|
|
|
};
|
2015-08-21 04:12:17 +00:00
|
|
|
} )( $.fn.show ),
|
2009-01-22 13:10:18 +00:00
|
|
|
|
2015-08-21 04:12:17 +00:00
|
|
|
hide: ( function( orig ) {
|
2013-02-28 18:34:49 +00:00
|
|
|
return function( option ) {
|
|
|
|
if ( standardAnimationOption( option ) ) {
|
|
|
|
return orig.apply( this, arguments );
|
|
|
|
} else {
|
|
|
|
var args = _normalizeArguments.apply( this, arguments );
|
|
|
|
args.mode = "hide";
|
|
|
|
return this.effect.call( this, args );
|
|
|
|
}
|
|
|
|
};
|
2015-08-21 04:12:17 +00:00
|
|
|
} )( $.fn.hide ),
|
2009-01-22 13:10:18 +00:00
|
|
|
|
2015-08-21 04:12:17 +00:00
|
|
|
toggle: ( function( orig ) {
|
2013-02-28 18:34:49 +00:00
|
|
|
return function( option ) {
|
|
|
|
if ( standardAnimationOption( option ) || typeof option === "boolean" ) {
|
|
|
|
return orig.apply( this, arguments );
|
|
|
|
} else {
|
|
|
|
var args = _normalizeArguments.apply( this, arguments );
|
|
|
|
args.mode = "toggle";
|
|
|
|
return this.effect.call( this, args );
|
|
|
|
}
|
|
|
|
};
|
2015-08-21 04:12:17 +00:00
|
|
|
} )( $.fn.toggle ),
|
2009-01-22 13:10:18 +00:00
|
|
|
|
2015-08-21 04:12:17 +00:00
|
|
|
cssUnit: function( key ) {
|
2011-03-07 02:44:35 +00:00
|
|
|
var style = this.css( key ),
|
|
|
|
val = [];
|
|
|
|
|
2011-05-12 07:51:06 +00:00
|
|
|
$.each( [ "em", "px", "%", "pt" ], function( i, unit ) {
|
2012-04-02 23:12:21 +00:00
|
|
|
if ( style.indexOf( unit ) > 0 ) {
|
2011-03-07 02:44:35 +00:00
|
|
|
val = [ parseFloat( style ), unit ];
|
2012-04-02 23:12:21 +00:00
|
|
|
}
|
2015-08-21 04:12:17 +00:00
|
|
|
} );
|
2008-06-06 19:47:31 +00:00
|
|
|
return val;
|
2012-12-26 13:35:42 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
cssClip: function( clipObj ) {
|
2016-03-31 04:31:28 +00:00
|
|
|
if ( clipObj ) {
|
|
|
|
return this.css( "clip", "rect(" + clipObj.top + "px " + clipObj.right + "px " +
|
|
|
|
clipObj.bottom + "px " + clipObj.left + "px)" );
|
|
|
|
}
|
|
|
|
return parseClip( this.css( "clip" ), this );
|
2012-12-26 13:35:42 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
transfer: function( options, done ) {
|
|
|
|
var element = $( this ),
|
|
|
|
target = $( options.to ),
|
|
|
|
targetFixed = target.css( "position" ) === "fixed",
|
|
|
|
body = $( "body" ),
|
|
|
|
fixTop = targetFixed ? body.scrollTop() : 0,
|
|
|
|
fixLeft = targetFixed ? body.scrollLeft() : 0,
|
|
|
|
endPosition = target.offset(),
|
|
|
|
animation = {
|
|
|
|
top: endPosition.top - fixTop,
|
|
|
|
left: endPosition.left - fixLeft,
|
|
|
|
height: target.innerHeight(),
|
|
|
|
width: target.innerWidth()
|
|
|
|
},
|
|
|
|
startPosition = element.offset(),
|
2019-12-08 21:23:08 +00:00
|
|
|
transfer = $( "<div class='ui-effects-transfer'></div>" );
|
|
|
|
|
|
|
|
transfer
|
|
|
|
.appendTo( "body" )
|
|
|
|
.addClass( options.className )
|
|
|
|
.css( {
|
|
|
|
top: startPosition.top - fixTop,
|
|
|
|
left: startPosition.left - fixLeft,
|
|
|
|
height: element.innerHeight(),
|
|
|
|
width: element.innerWidth(),
|
|
|
|
position: targetFixed ? "fixed" : "absolute"
|
|
|
|
} )
|
|
|
|
.animate( animation, options.duration, options.easing, function() {
|
|
|
|
transfer.remove();
|
|
|
|
if ( typeof done === "function" ) {
|
|
|
|
done();
|
|
|
|
}
|
|
|
|
} );
|
2008-06-06 19:47:31 +00:00
|
|
|
}
|
2015-08-21 04:12:17 +00:00
|
|
|
} );
|
2008-06-06 19:47:31 +00:00
|
|
|
|
2012-12-26 13:35:42 +00:00
|
|
|
function parseClip( str, element ) {
|
|
|
|
var outerWidth = element.outerWidth(),
|
|
|
|
outerHeight = element.outerHeight(),
|
|
|
|
clipRegex = /^rect\((-?\d*\.?\d*px|-?\d+%|auto),?\s*(-?\d*\.?\d*px|-?\d+%|auto),?\s*(-?\d*\.?\d*px|-?\d+%|auto),?\s*(-?\d*\.?\d*px|-?\d+%|auto)\)$/,
|
|
|
|
values = clipRegex.exec( str ) || [ "", 0, outerWidth, outerHeight, 0 ];
|
|
|
|
|
|
|
|
return {
|
|
|
|
top: parseFloat( values[ 1 ] ) || 0,
|
|
|
|
right: values[ 2 ] === "auto" ? outerWidth : parseFloat( values[ 2 ] ),
|
|
|
|
bottom: values[ 3 ] === "auto" ? outerHeight : parseFloat( values[ 3 ] ),
|
|
|
|
left: parseFloat( values[ 4 ] ) || 0
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
$.fx.step.clip = function( fx ) {
|
|
|
|
if ( !fx.clipInit ) {
|
|
|
|
fx.start = $( fx.elem ).cssClip();
|
|
|
|
if ( typeof fx.end === "string" ) {
|
|
|
|
fx.end = parseClip( fx.end, fx.elem );
|
|
|
|
}
|
|
|
|
fx.clipInit = true;
|
|
|
|
}
|
|
|
|
|
2015-08-21 04:12:17 +00:00
|
|
|
$( fx.elem ).cssClip( {
|
|
|
|
top: fx.pos * ( fx.end.top - fx.start.top ) + fx.start.top,
|
|
|
|
right: fx.pos * ( fx.end.right - fx.start.right ) + fx.start.right,
|
|
|
|
bottom: fx.pos * ( fx.end.bottom - fx.start.bottom ) + fx.start.bottom,
|
|
|
|
left: fx.pos * ( fx.end.left - fx.start.left ) + fx.start.left
|
|
|
|
} );
|
2012-12-26 13:35:42 +00:00
|
|
|
};
|
|
|
|
|
2015-08-21 04:12:17 +00:00
|
|
|
} )();
|
2008-06-06 19:47:31 +00:00
|
|
|
|
2009-11-10 15:55:41 +00:00
|
|
|
/******************************************************************************/
|
|
|
|
/*********************************** EASING ***********************************/
|
|
|
|
/******************************************************************************/
|
2008-11-18 02:55:25 +00:00
|
|
|
|
2015-08-21 04:12:17 +00:00
|
|
|
( function() {
|
2012-04-02 23:12:21 +00:00
|
|
|
|
2015-08-21 04:12:17 +00:00
|
|
|
// Based on easing equations from Robert Penner (http://www.robertpenner.com/easing)
|
2008-05-23 09:26:18 +00:00
|
|
|
|
2012-02-11 17:20:46 +00:00
|
|
|
var baseEasings = {};
|
2008-05-23 09:26:18 +00:00
|
|
|
|
2012-02-11 17:20:46 +00:00
|
|
|
$.each( [ "Quad", "Cubic", "Quart", "Quint", "Expo" ], function( i, name ) {
|
|
|
|
baseEasings[ name ] = function( p ) {
|
|
|
|
return Math.pow( p, i + 2 );
|
|
|
|
};
|
2015-08-21 04:12:17 +00:00
|
|
|
} );
|
2012-02-11 17:20:46 +00:00
|
|
|
|
|
|
|
$.extend( baseEasings, {
|
2013-10-16 18:43:09 +00:00
|
|
|
Sine: function( p ) {
|
2012-02-11 17:20:46 +00:00
|
|
|
return 1 - Math.cos( p * Math.PI / 2 );
|
2011-03-07 02:44:35 +00:00
|
|
|
},
|
2013-10-16 18:43:09 +00:00
|
|
|
Circ: function( p ) {
|
2012-02-11 17:20:46 +00:00
|
|
|
return 1 - Math.sqrt( 1 - p * p );
|
2011-03-07 02:44:35 +00:00
|
|
|
},
|
2012-02-11 17:20:46 +00:00
|
|
|
Elastic: function( p ) {
|
|
|
|
return p === 0 || p === 1 ? p :
|
2015-08-21 04:12:17 +00:00
|
|
|
-Math.pow( 2, 8 * ( p - 1 ) ) * Math.sin( ( ( p - 1 ) * 80 - 7.5 ) * Math.PI / 15 );
|
2011-03-07 02:44:35 +00:00
|
|
|
},
|
2012-02-11 17:20:46 +00:00
|
|
|
Back: function( p ) {
|
|
|
|
return p * p * ( 3 * p - 2 );
|
2008-05-23 09:26:18 +00:00
|
|
|
},
|
2013-10-16 18:43:09 +00:00
|
|
|
Bounce: function( p ) {
|
2012-02-11 17:20:46 +00:00
|
|
|
var pow2,
|
|
|
|
bounce = 4;
|
2012-03-01 12:42:42 +00:00
|
|
|
|
2012-02-11 17:20:46 +00:00
|
|
|
while ( p < ( ( pow2 = Math.pow( 2, --bounce ) ) - 1 ) / 11 ) {}
|
|
|
|
return 1 / Math.pow( 4, 3 - bounce ) - 7.5625 * Math.pow( ( pow2 * 3 - 2 ) / 22 - p, 2 );
|
2008-05-23 09:26:18 +00:00
|
|
|
}
|
2015-08-21 04:12:17 +00:00
|
|
|
} );
|
2008-05-23 09:26:18 +00:00
|
|
|
|
2012-02-11 17:20:46 +00:00
|
|
|
$.each( baseEasings, function( name, easeIn ) {
|
|
|
|
$.easing[ "easeIn" + name ] = easeIn;
|
|
|
|
$.easing[ "easeOut" + name ] = function( p ) {
|
|
|
|
return 1 - easeIn( 1 - p );
|
|
|
|
};
|
|
|
|
$.easing[ "easeInOut" + name ] = function( p ) {
|
2012-04-02 19:55:50 +00:00
|
|
|
return p < 0.5 ?
|
2012-02-11 17:20:46 +00:00
|
|
|
easeIn( p * 2 ) / 2 :
|
2012-04-20 17:58:33 +00:00
|
|
|
1 - easeIn( p * -2 + 2 ) / 2;
|
2012-02-11 17:20:46 +00:00
|
|
|
};
|
2015-08-21 04:12:17 +00:00
|
|
|
} );
|
2008-05-23 09:26:18 +00:00
|
|
|
|
2015-08-21 04:12:17 +00:00
|
|
|
} )();
|
2012-04-02 23:12:21 +00:00
|
|
|
|
2013-07-12 16:40:48 +00:00
|
|
|
return $.effects;
|
|
|
|
|
2021-06-06 22:58:12 +00:00
|
|
|
} );
|