aboutsummaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authorgnarf <gnarf@gnarf.net>2011-06-21 00:23:52 -0500
committergnarf <gnarf@gnarf.net>2011-06-21 01:18:01 -0500
commit1c1a3b1a361d90a73755fbd038b3cdfb0960c29f (patch)
treef86c98826a6c72421c9bc20b4e75855598bebf34 /ui
parentfb210ae1ec16cefb1e4d4dfaf7d55499cac53ab8 (diff)
downloadjquery-ui-1c1a3b1a361d90a73755fbd038b3cdfb0960c29f.tar.gz
jquery-ui-1c1a3b1a361d90a73755fbd038b3cdfb0960c29f.zip
Effects.*: Updating Effect Method API to avoid duplicating the queue call - Fixes #7318 - Add the queue functions to $.fn.effect()
Diffstat (limited to 'ui')
-rw-r--r--ui/jquery.effects.blind.js112
-rw-r--r--ui/jquery.effects.bounce.js184
-rw-r--r--ui/jquery.effects.clip.js93
-rw-r--r--ui/jquery.effects.core.js7
-rw-r--r--ui/jquery.effects.drop.js84
-rw-r--r--ui/jquery.effects.explode.js142
-rw-r--r--ui/jquery.effects.fade.js40
-rw-r--r--ui/jquery.effects.fold.js94
-rw-r--r--ui/jquery.effects.highlight.js62
-rw-r--r--ui/jquery.effects.pulsate.js78
-rw-r--r--ui/jquery.effects.scale.js447
-rw-r--r--ui/jquery.effects.shake.js103
-rw-r--r--ui/jquery.effects.slide.js90
-rw-r--r--ui/jquery.effects.transfer.js63
14 files changed, 785 insertions, 814 deletions
diff --git a/ui/jquery.effects.blind.js b/ui/jquery.effects.blind.js
index b6485b641..8c536be78 100644
--- a/ui/jquery.effects.blind.js
+++ b/ui/jquery.effects.blind.js
@@ -12,73 +12,69 @@
*/
(function( $, undefined ) {
-var rvertical = /up|down|vertical/;
-var rpositivemotion = /up|left|vertical|horizontal/;
+var rvertical = /up|down|vertical/,
+ rpositivemotion = /up|left|vertical|horizontal/;
-$.effects.effect.blind = function( o ) {
+$.effects.effect.blind = function( o, next ) {
+ // Create element
+ var el = $( this ),
+ props = [ "position", "top", "bottom", "left", "right", "height", "width" ],
+ mode = $.effects.setMode( el, o.mode || "hide" ),
+ direction = o.direction || "up",
+ vertical = rvertical.test( direction ),
+ ref = vertical ? "height" : "width",
+ ref2 = vertical ? "top" : "left",
+ motion = rpositivemotion.test( direction ),
+ animation = {},
+ show = mode === "show",
+ wrapper, distance;
- return this.queue( function() {
-
- // Create element
- var el = $( this ),
- props = [ "position", "top", "bottom", "left", "right", "height", "width" ],
- mode = $.effects.setMode( el, o.mode || "hide" ),
- direction = o.direction || "up",
- vertical = rvertical.test( direction ),
- ref = vertical ? "height" : "width",
- ref2 = vertical ? "top" : "left",
- motion = rpositivemotion.test( direction ),
- animation = {},
- wrapper, distance;
+ // if already wrapped, the wrapper's properties are my property. #6245
+ if ( el.parent().is( ".ui-effects-wrapper" ) ) {
+ $.effects.save( el.parent(), props );
+ } else {
+ $.effects.save( el, props );
+ }
+ el.show();
+ wrapper = $.effects.createWrapper( el ).css({
+ overflow: "hidden"
+ });
- // if already wrapped, the wrapper's properties are my property. #6245
- if ( el.parent().is( ".ui-effects-wrapper" ) ) {
- $.effects.save( el.parent(), props );
- } else {
- $.effects.save( el, props );
- }
- el.show();
- wrapper = $.effects.createWrapper( el ).css({
- overflow: "hidden"
- });
+ distance = wrapper[ ref ]();
- distance = wrapper[ ref ]();
+ animation[ ref ] = ( mode === "show" ? distance : 0 );
+ if ( !motion ) {
+ el
+ .css( vertical ? "bottom" : "right", 0 )
+ .css( vertical ? "top" : "left", "" )
+ .css({ position: "absolute" });
+ animation[ ref2 ] = ( mode === "show" ) ? 0 : distance;
+ }
- animation[ ref ] = ( mode === "show" ? distance : 0 );
- if ( !motion ) {
- el
- .css( vertical ? "bottom" : "right", 0 )
- .css( vertical ? "top" : "left", "" )
- .css({ position: "absolute" });
- animation[ ref2 ] = ( mode === "show" ) ? 0 : distance;
+ // start at 0 if we are showing
+ if ( mode === "show" ) {
+ wrapper.css( ref, 0 );
+ if ( ! motion ) {
+ wrapper.css( ref2, distance );
}
+ }
- // start at 0 if we are showing
- if ( mode == "show" ) {
- wrapper.css( ref, 0 );
- if ( ! motion ) {
- wrapper.css( ref2, distance );
+ // Animate
+ wrapper.animate( animation, {
+ duration: o.duration,
+ easing: o.easing,
+ queue: false,
+ complete: function() {
+ if ( mode == "hide" ) {
+ el.hide();
}
- }
-
- // Animate
- wrapper.animate( animation, {
- duration: o.duration,
- easing: o.easing,
- queue: false,
- complete: function() {
- if ( mode == "hide" ) {
- el.hide();
- }
- $.effects.restore( el, props );
- $.effects.removeWrapper( el );
- if ( $.isFunction( o.complete ) ) {
- o.complete.apply( el[ 0 ], arguments );
- }
- el.dequeue();
+ $.effects.restore( el, props );
+ $.effects.removeWrapper( el );
+ if ( $.isFunction( o.complete ) ) {
+ o.complete.apply( el[ 0 ], arguments );
}
- });
-
+ next();
+ }
});
};
diff --git a/ui/jquery.effects.bounce.js b/ui/jquery.effects.bounce.js
index 78fedb0ce..f6cf5bb02 100644
--- a/ui/jquery.effects.bounce.js
+++ b/ui/jquery.effects.bounce.js
@@ -12,108 +12,104 @@
*/
(function( $, undefined ) {
-$.effects.effect.bounce = function(o) {
-
- return this.queue( function( next ) {
- var el = $( this ),
- props = [ "position", "top", "bottom", "left", "right", "height", "width" ],
-
- // defaults:
- mode = $.effects.setMode( el, o.mode || "effect" ),
- hide = mode === "hide",
- show = mode === "show",
- direction = o.direction || "up",
- distance = o.distance,
- times = o.times || 5,
-
- // number of internal animations
- anims = times * 2 + ( show || hide ? 1 : 0 ),
- speed = o.duration / anims,
- easing = o.easing,
-
- // utility:
- ref = ( direction === "up" || direction === "down" ) ? "top" : "left",
- motion = ( direction === "up" || direction === "left" ),
- i,
- upAnim,
- downAnim,
-
- // we will need to re-assemble the queue to stack our animations in place
- queue = el.queue(),
- queuelen = queue.length;
-
- // Avoid touching opacity to prevent clearType and PNG issues in IE
- if ( show || hide ) {
- props.push( "opacity" );
- }
-
- $.effects.save( el, props );
- el.show();
- $.effects.createWrapper( el ); // Create Wrapper
-
- // default distance for the BIGGEST bounce is the outer Distance / 3
- if ( !distance ) {
- distance = el[ ref === "top" ? "outerHeight" : "outerWidth" ]() / 3;
- }
-
- if ( show ) {
- downAnim = { opacity: 1 };
- downAnim[ ref ] = 0;
-
- // if we are showing, force opacity 0 and set the initial position
- // then do the "first" animation
- el.css( "opacity", 0 )
- .css( ref, motion ? -distance*2 : distance*2 )
- .animate( downAnim, speed, easing );
- }
-
- // start at the smallest distance if we are hiding
- if ( hide ) {
- distance = distance / Math.pow( 2, times - 1 );
- }
-
- downAnim = {};
+$.effects.effect.bounce = function( o, next ) {
+ var el = $( this ),
+ props = [ "position", "top", "bottom", "left", "right", "height", "width" ],
+
+ // defaults:
+ mode = $.effects.setMode( el, o.mode || "effect" ),
+ hide = mode === "hide",
+ show = mode === "show",
+ direction = o.direction || "up",
+ distance = o.distance,
+ times = o.times || 5,
+
+ // number of internal animations
+ anims = times * 2 + ( show || hide ? 1 : 0 ),
+ speed = o.duration / anims,
+ easing = o.easing,
+
+ // utility:
+ ref = ( direction === "up" || direction === "down" ) ? "top" : "left",
+ motion = ( direction === "up" || direction === "left" ),
+ i,
+ upAnim,
+ downAnim,
+
+ // we will need to re-assemble the queue to stack our animations in place
+ queue = el.queue(),
+ queuelen = queue.length;
+
+ // Avoid touching opacity to prevent clearType and PNG issues in IE
+ if ( show || hide ) {
+ props.push( "opacity" );
+ }
+
+ $.effects.save( el, props );
+ el.show();
+ $.effects.createWrapper( el ); // Create Wrapper
+
+ // default distance for the BIGGEST bounce is the outer Distance / 3
+ if ( !distance ) {
+ distance = el[ ref === "top" ? "outerHeight" : "outerWidth" ]() / 3;
+ }
+
+ if ( show ) {
+ downAnim = { opacity: 1 };
downAnim[ ref ] = 0;
- // Bounces up/down/left/right then back to 0 -- times * 2 animations happen here
- for ( i = 0; i < times; i++ ) {
- upAnim = {};
- upAnim[ ref ] = ( motion ? "-=" : "+=" ) + distance;
-
- el.animate( upAnim, speed, easing )
- .animate( downAnim, speed, easing );
-
- distance = hide ? distance * 2 : distance / 2;
- }
- // Last Bounce when Hiding
+ // if we are showing, force opacity 0 and set the initial position
+ // then do the "first" animation
+ el.css( "opacity", 0 )
+ .css( ref, motion ? -distance*2 : distance*2 )
+ .animate( downAnim, speed, easing );
+ }
+
+ // start at the smallest distance if we are hiding
+ if ( hide ) {
+ distance = distance / Math.pow( 2, times - 1 );
+ }
+
+ downAnim = {};
+ downAnim[ ref ] = 0;
+ // Bounces up/down/left/right then back to 0 -- times * 2 animations happen here
+ for ( i = 0; i < times; i++ ) {
+ upAnim = {};
+ upAnim[ ref ] = ( motion ? "-=" : "+=" ) + distance;
+
+ el.animate( upAnim, speed, easing )
+ .animate( downAnim, speed, easing );
+
+ distance = hide ? distance * 2 : distance / 2;
+ }
+
+ // Last Bounce when Hiding
+ if ( hide ) {
+ upAnim = { opacity: 0 };
+ upAnim[ ref ] = ( motion ? "-=" : "+=" ) + distance;
+
+ el.animate( upAnim, speed, easing );
+ }
+
+ el.queue( function( next ) {
if ( hide ) {
- upAnim = { opacity: 0 };
- upAnim[ ref ] = ( motion ? "-=" : "+=" ) + distance;
-
- el.animate( upAnim, speed, easing );
+ el.hide();
}
-
- el.queue( function( next ) {
- if ( hide ) {
- el.hide();
- }
- $.effects.restore( el, props );
- $.effects.removeWrapper( el );
- if ( o.complete ) {
- o.complete.apply( el[ 0 ] );
- }
- next();
- });
-
- // inject all the animations we just queued to be first in line (after "inprogress")
- if ( queuelen > 1) {
- queue.splice.apply( queue,
- [ 1, 0 ].concat( queue.splice( queuelen, anims + 1 ) ) );
+ $.effects.restore( el, props );
+ $.effects.removeWrapper( el );
+ if ( o.complete ) {
+ o.complete.apply( el[ 0 ] );
}
next();
-
});
+ // inject all the animations we just queued to be first in line (after "inprogress")
+ if ( queuelen > 1) {
+ queue.splice.apply( queue,
+ [ 1, 0 ].concat( queue.splice( queuelen, anims + 1 ) ) );
+ }
+ next();
+
};
})(jQuery);
diff --git a/ui/jquery.effects.clip.js b/ui/jquery.effects.clip.js
index dbf0d36c9..8c5c76e8c 100644
--- a/ui/jquery.effects.clip.js
+++ b/ui/jquery.effects.clip.js
@@ -12,61 +12,56 @@
*/
(function( $, undefined ) {
-$.effects.effect.clip = function( o ) {
+$.effects.effect.clip = function( o, next ) {
+ // Create element
+ var el = $( this ),
+ props = [ "position", "top", "bottom", "left", "right", "height", "width" ],
+ mode = $.effects.setMode( el, o.mode || "hide" ),
+ show = mode === "show",
+ direction = o.direction || "vertical",
+ vert = direction === "vertical",
+ size = vert ? "height" : "width",
+ position = vert ? "top" : "left",
+ animation = {},
+ wrapper, animate, distance;
- return this.queue( function() {
+ // Save & Show
+ $.effects.save( el, props );
+ el.show();
- // Create element
- var el = $( this ),
- props = [ "position", "top", "bottom", "left", "right", "height", "width" ],
- mode = $.effects.setMode( el, o.mode || "hide" ),
- show = mode === "show",
- direction = o.direction || "vertical",
- vert = direction === "vertical",
- size = vert ? "height" : "width",
- position = vert ? "top" : "left",
- animation = {},
- wrapper, animate, distance;
-
- // Save & Show
- $.effects.save( el, props );
- el.show();
-
- // Create Wrapper
- wrapper = $.effects.createWrapper( el ).css({
- overflow: "hidden"
- });
- animate = ( el[0].tagName === "IMG" ) ? wrapper : el;
- distance = animate[ size ]();
+ // Create Wrapper
+ wrapper = $.effects.createWrapper( el ).css({
+ overflow: "hidden"
+ });
+ animate = ( el[0].tagName === "IMG" ) ? wrapper : el;
+ distance = animate[ size ]();
- // Shift
- if ( show ) {
- animate.css( size, 0 );
- animate.css( position, distance / 2 );
- }
+ // Shift
+ if ( show ) {
+ animate.css( size, 0 );
+ animate.css( position, distance / 2 );
+ }
- // Create Animation Object:
- animation[ size ] = show ? distance : 0;
- animation[ position ] = show ? 0 : distance / 2;
+ // Create Animation Object:
+ animation[ size ] = show ? distance : 0;
+ animation[ position ] = show ? 0 : distance / 2;
- // Animate
- animate.animate( animation, {
- queue: false,
- duration: o.duration,
- easing: o.easing,
- complete: function() {
- if ( !show ) {
- el.hide();
- }
- $.effects.restore( el, props );
- $.effects.removeWrapper( el );
- if ( $.isFunction( o.complete ) ) {
- o.complete.apply( el[ 0 ], arguments );
- }
- el.dequeue();
+ // Animate
+ animate.animate( animation, {
+ queue: false,
+ duration: o.duration,
+ easing: o.easing,
+ complete: function() {
+ if ( !show ) {
+ el.hide();
}
- });
-
+ $.effects.restore( el, props );
+ $.effects.removeWrapper( el );
+ if ( $.isFunction( o.complete ) ) {
+ o.complete.apply( el[ 0 ], arguments );
+ }
+ el.dequeue();
+ }
});
};
diff --git a/ui/jquery.effects.core.js b/ui/jquery.effects.core.js
index 00a803360..87fc5a074 100644
--- a/ui/jquery.effects.core.js
+++ b/ui/jquery.effects.core.js
@@ -536,6 +536,7 @@ $.fn.extend({
effect: function( effect, options, speed, callback ) {
var args = _normalizeArguments.apply( this, arguments ),
mode = args.mode,
+ queue = args.queue,
effectMethod = $.effects.effect[ args.effect ],
// DEPRECATED: remove in 2.0 (#7115)
@@ -554,9 +555,13 @@ $.fn.extend({
}
}
+ function run( next ) {
+ effectMethod.call( this, args, $.isFunction( next ) ? next : $.noop );
+ }
+
// TODO: remove this check in 2.0, effectMethod will always be true
if ( effectMethod ) {
- return effectMethod.call( this, args );
+ return queue === false ? this.each( run ) : this.queue( queue || "fx", run );
} else {
// DEPRECATED: remove in 2.0 (#7115)
return oldEffectMethod.call(this, {
diff --git a/ui/jquery.effects.drop.js b/ui/jquery.effects.drop.js
index 4265b737b..a0bdc7d4d 100644
--- a/ui/jquery.effects.drop.js
+++ b/ui/jquery.effects.drop.js
@@ -12,51 +12,47 @@
*/
(function( $, undefined ) {
-$.effects.effect.drop = function( o ) {
-
- return this.queue( function() {
-
- var el = $( this ),
- props = [ 'position', 'top', 'bottom', 'left', 'right', 'opacity', "height", "width" ],
- mode = $.effects.setMode( el, o.mode || 'hide' ),
- direction = o.direction || 'left',
- ref = ( direction == 'up' || direction == 'down' ) ? 'top' : 'left',
- motion = ( direction == 'up' || direction == 'left' ) ? 'pos' : 'neg',
- animation = {
- opacity: mode == 'show' ? 1 : 0
- },
- distance;
-
- // Adjust
- $.effects.save( el, props );
- el.show();
- $.effects.createWrapper( el );
-
- distance = o.distance || el[ ref == 'top' ? 'outerHeight': 'outerWidth' ]({ margin: true }) / 2;
-
- if ( mode == 'show' ) {
- el
- .css( 'opacity', 0 )
- .css( ref, motion == 'pos' ? -distance : distance );
+$.effects.effect.drop = function( o, next ) {
+
+ var el = $( this ),
+ props = [ "position", "top", "bottom", "left", "right", "opacity", "height", "width" ],
+ mode = $.effects.setMode( el, o.mode || "hide" ),
+ direction = o.direction || "left",
+ ref = ( direction == "up" || direction == "down" ) ? "top" : "left",
+ motion = ( direction == "up" || direction == "left" ) ? "pos" : "neg",
+ animation = {
+ opacity: mode == "show" ? 1 : 0
+ },
+ distance;
+
+ // Adjust
+ $.effects.save( el, props );
+ el.show();
+ $.effects.createWrapper( el );
+
+ distance = o.distance || el[ ref == "top" ? "outerHeight": "outerWidth" ]({ margin: true }) / 2;
+
+ if ( mode == "show" ) {
+ el
+ .css( "opacity", 0 )
+ .css( ref, motion == "pos" ? -distance : distance );
+ }
+
+ // Animation
+ animation[ ref ] = ((mode == "show") ? (motion == "pos" ? "+=" : "-=") : (motion == "pos" ? "-=" : "+=")) + distance;
+
+ // Animate
+ el.animate( animation, {
+ queue: false,
+ duration: o.duration,
+ easing: o.easing,
+ complete: function() {
+ mode == "hide" && el.hide();
+ $.effects.restore( el, props );
+ $.effects.removeWrapper( el );
+ $.isFunction( o.complete ) && o.complete.apply(this, arguments);
+ next();
}
-
- // Animation
- animation[ ref ] = ((mode == 'show') ? (motion == 'pos' ? '+=' : '-=') : (motion == 'pos' ? '-=' : '+=')) + distance;
-
- // Animate
- el.animate( animation, {
- queue: false,
- duration: o.duration,
- easing: o.easing,
- complete: function() {
- mode == 'hide' && el.hide();
- $.effects.restore( el, props );
- $.effects.removeWrapper( el );
- $.isFunction( o.complete ) && o.complete.apply(this, arguments);
- el.dequeue();
- }
- });
-
});
};
diff --git a/ui/jquery.effects.explode.js b/ui/jquery.effects.explode.js
index f5217ecb5..76711c6f2 100644
--- a/ui/jquery.effects.explode.js
+++ b/ui/jquery.effects.explode.js
@@ -12,92 +12,88 @@
*/
(function( $, undefined ) {
-$.effects.effect.explode = function( o ) {
+$.effects.effect.explode = function( o, next ) {
- return this.queue( function( next ) {
+ var rows = o.pieces ? Math.round(Math.sqrt(o.pieces)) : 3,
+ cells = rows,
+ el = $( this ),
+ mode = $.effects.setMode( el, o.mode || "hide" ),
+ show = ( mode == "show" ),
- var rows = o.pieces ? Math.round(Math.sqrt(o.pieces)) : 3,
- cells = rows,
- el = $( this ),
- mode = $.effects.setMode( el, o.mode || 'hide' ),
- show = ( mode == 'show' ),
+ // show and then visibility:hidden the element before calculating offset
+ offset = el.show().css( "visibility", "hidden" ).offset(),
- // show and then visibility:hidden the element before calculating offset
- offset = el.show().css( 'visibility', 'hidden' ).offset(),
+ // width and height of a piece
+ width = Math.ceil( el.outerWidth() / cells ),
+ height = Math.ceil( el.outerHeight() / rows ),
+ pieces = [],
- // width and height of a piece
- width = Math.ceil( el.outerWidth() / cells ),
- height = Math.ceil( el.outerHeight() / rows ),
- pieces = [],
+ // loop
+ i, j, left, top, mx, my;
- // loop
- i, j, left, top, mx, my;
+ // clone the element for each row and cell.
+ for( i = 0; i < rows ; i++ ) { // ===>
+ top = offset.top + i * height;
+ my = i - ( rows - 1 ) / 2 ;
- // clone the element for each row and cell.
- for( i = 0; i < rows ; i++ ) { // ===>
- top = offset.top + i * height;
- my = i - ( rows - 1 ) / 2 ;
+ for( j = 0; j < cells ; j++ ) { // |||
+ left = offset.left + j * width;
+ mx = j - ( cells - 1 ) / 2 ;
- for( j = 0; j < cells ; j++ ) { // |||
- left = offset.left + j * width;
- mx = j - ( cells - 1 ) / 2 ;
+ // Create a clone of the now hidden main element that will be absolute positioned
+ // within a wrapper div off the -left and -top equal to size of our pieces
+ el
+ .clone()
+ .appendTo( "body" )
+ .wrap( "<div></div>" )
+ .css({
+ position: "absolute",
+ visibility: "visible",
+ left: -j * width,
+ top: -i * height
+ })
- // Create a clone of the now hidden main element that will be absolute positioned
- // within a wrapper div off the -left and -top equal to size of our pieces
- el
- .clone()
- .appendTo( 'body' )
- .wrap( '<div></div>' )
- .css({
- position: 'absolute',
- visibility: 'visible',
- left: -j * width,
- top: -i * height
- })
-
- // select the wrapper - make it overflow: hidden and absolute positioned based on
- // where the original was located +left and +top equal to the size of pieces
- .parent()
- .addClass( 'ui-effects-explode' )
- .css({
- position: 'absolute',
- overflow: 'hidden',
- width: width,
- height: height,
- left: left + ( show ? mx * width : 0 ),
- top: top + ( show ? my * height : 0 ),
- opacity: show ? 0 : 1
- }).animate({
- left: left + ( show ? 0 : mx * width ),
- top: top + ( show ? 0 : my * height ),
- opacity: show ? 1 : 0
- }, o.duration || 500, o.easing, childComplete );
- }
+ // select the wrapper - make it overflow: hidden and absolute positioned based on
+ // where the original was located +left and +top equal to the size of pieces
+ .parent()
+ .addClass( "ui-effects-explode" )
+ .css({
+ position: "absolute",
+ overflow: "hidden",
+ width: width,
+ height: height,
+ left: left + ( show ? mx * width : 0 ),
+ top: top + ( show ? my * height : 0 ),
+ opacity: show ? 0 : 1
+ }).animate({
+ left: left + ( show ? 0 : mx * width ),
+ top: top + ( show ? 0 : my * height ),
+ opacity: show ? 1 : 0
+ }, o.duration || 500, o.easing, childComplete );
}
+ }
- // children animate complete:
- function childComplete() {
- pieces.push( this );
- if ( pieces.length == rows * cells ) {
- animComplete();
- }
+ // children animate complete:
+ function childComplete() {
+ pieces.push( this );
+ if ( pieces.length == rows * cells ) {
+ animComplete();
}
+ }
- function animComplete() {
- el.css({
- visibility: 'visible'
- });
- $( pieces ).remove();
- if ( !show ) {
- el.hide();
- }
- if ( $.isFunction( o.complete ) ) {
- o.complete.apply( el[ 0 ] );
- }
- next();
+ function animComplete() {
+ el.css({
+ visibility: "visible"
+ });
+ $( pieces ).remove();
+ if ( !show ) {
+ el.hide();
}
- });
-
+ if ( $.isFunction( o.complete ) ) {
+ o.complete.apply( el[ 0 ] );
+ }
+ next();
+ }
};
})(jQuery);
diff --git a/ui/jquery.effects.fade.js b/ui/jquery.effects.fade.js
index ff1cba5f8..8f2d956dc 100644
--- a/ui/jquery.effects.fade.js
+++ b/ui/jquery.effects.fade.js
@@ -12,29 +12,27 @@
*/
(function( $, undefined ) {
-$.effects.effect.fade = function( o ) {
- return this.queue( function( next ) {
- var el = $( this ),
- mode = $.effects.setMode( el, o.mode || 'toggle' ),
- hide = mode === "hide";
+$.effects.effect.fade = function( o, next ) {
+ var el = $( this ),
+ mode = $.effects.setMode( el, o.mode || "toggle" ),
+ hide = mode === "hide";
- el.show();
- el.animate({
- opacity: hide ? 0 : 1
- }, {
- queue: false,
- duration: o.duration,
- easing: o.easing,
- complete: function() {
- if ( hide ) {
- el.hide();
- }
- if ( o.complete ) {
- o.complete.call( this );
- }
- next();
+ el.show();
+ el.animate({
+ opacity: hide ? 0 : 1
+ }, {
+ queue: false,
+ duration: o.duration,
+ easing: o.easing,
+ complete: function() {
+ if ( hide ) {
+ el.hide();
}
- });
+ if ( o.complete ) {
+ o.complete.call( this );
+ }
+ next();
+ }
});
};
diff --git a/ui/jquery.effects.fold.js b/ui/jquery.effects.fold.js
index 6100c33a1..de7530bf0 100644
--- a/ui/jquery.effects.fold.js
+++ b/ui/jquery.effects.fold.js
@@ -12,61 +12,57 @@
*/
(function( $, undefined ) {
-$.effects.effect.fold = function( o ) {
+$.effects.effect.fold = function( o, next ) {
- return this.queue( function() {
+ // Create element
+ var el = $( this ),
+ props = ["position","top","bottom","left","right","height","width"],
+ mode = $.effects.setMode(el, o.mode || "hide"),
+ size = o.size || 15,
+ percent = /([0-9]+)%/.exec(size),
+ horizFirst = !!o.horizFirst,
+ widthFirst = ((mode == "show") != horizFirst),
+ ref = widthFirst ? ["width", "height"] : ["height", "width"],
+ duration = o.duration / 2,
+ wrapper, distance;
- // Create element
- var el = $( this ),
- props = ['position','top','bottom','left','right','height','width'],
- mode = $.effects.setMode(el, o.mode || 'hide'),
- size = o.size || 15,
- percent = /([0-9]+)%/.exec(size),
- horizFirst = !!o.horizFirst,
- widthFirst = ((mode == 'show') != horizFirst),
- ref = widthFirst ? ['width', 'height'] : ['height', 'width'],
- duration = o.duration / 2,
- wrapper, distance;
+ $.effects.save( el, props );
+ el.show();
- $.effects.save( el, props );
- el.show();
-
- // Create Wrapper
- wrapper = $.effects.createWrapper( el ).css({
- overflow: 'hidden'
- });
- distance = widthFirst ?
- [ wrapper.width(), wrapper.height() ] :
- [ wrapper.height(), wrapper.width() ];
-
- if ( percent ) {
- size = parseInt( percent[ 1 ], 10 ) / 100 * distance[ ( mode == 'hide') ? 0 : 1 ];
- }
- mode == 'show' && wrapper.css( horizFirst ? {
- height: 0,
- width: size
- } : {
- height: size,
- width: 0
- });
+ // Create Wrapper
+ wrapper = $.effects.createWrapper( el ).css({
+ overflow: "hidden"
+ });
+ distance = widthFirst ?
+ [ wrapper.width(), wrapper.height() ] :
+ [ wrapper.height(), wrapper.width() ];
- // Animation
- var animation1 = {}, animation2 = {};
- animation1[ ref[ 0 ] ] = mode == 'show' ? distance[ 0 ] : size;
- animation2[ ref[ 1 ] ] = mode == 'show' ? distance[ 1 ] : 0;
+ if ( percent ) {
+ size = parseInt( percent[ 1 ], 10 ) / 100 * distance[ ( mode == "hide") ? 0 : 1 ];
+ }
+ mode == "show" && wrapper.css( horizFirst ? {
+ height: 0,
+ width: size
+ } : {
+ height: size,
+ width: 0
+ });
- // Animate
- wrapper
- .animate( animation1, duration, o.easing )
- .animate( animation2, duration, o.easing, function() {
- (mode == 'hide') && el.hide();
- $.effects.restore( el, props );
- $.effects.removeWrapper( el );
- jQuery.isFunction(o.complete) && o.complete.apply( el[ 0 ], arguments );
- el.dequeue();
- });
+ // Animation
+ var animation1 = {}, animation2 = {};
+ animation1[ ref[ 0 ] ] = mode == "show" ? distance[ 0 ] : size;
+ animation2[ ref[ 1 ] ] = mode == "show" ? distance[ 1 ] : 0;
- });
+ // Animate
+ wrapper
+ .animate( animation1, duration, o.easing )
+ .animate( animation2, duration, o.easing, function() {
+ (mode == "hide") && el.hide();
+ $.effects.restore( el, props );
+ $.effects.removeWrapper( el );
+ jQuery.isFunction(o.complete) && o.complete.apply( el[ 0 ], arguments );
+ next();
+ });
};
diff --git a/ui/jquery.effects.highlight.js b/ui/jquery.effects.highlight.js
index cd4f0705a..61826e696 100644
--- a/ui/jquery.effects.highlight.js
+++ b/ui/jquery.effects.highlight.js
@@ -12,40 +12,38 @@
*/
(function( $, undefined ) {
-$.effects.effect.highlight = function( o ) {
- return this.queue( function() {
- var elem = $( this ),
- props = [ 'backgroundImage', 'backgroundColor', 'opacity' ],
- mode = $.effects.setMode( elem, o.mode || 'show' ),
- animation = {
- backgroundColor: elem.css( 'backgroundColor' )
- };
+$.effects.effect.highlight = function( o, next ) {
+ var elem = $( this ),
+ props = [ "backgroundImage", "backgroundColor", "opacity" ],
+ mode = $.effects.setMode( elem, o.mode || "show" ),
+ animation = {
+ backgroundColor: elem.css( "backgroundColor" )
+ };
- if (mode == 'hide') {
- animation.opacity = 0;
- }
+ if (mode == "hide") {
+ animation.opacity = 0;
+ }
- $.effects.save( elem, props );
-
- elem
- .show()
- .css({
- backgroundImage: 'none',
- backgroundColor: o.color || '#ffff99'
- })
- .animate( animation, {
- queue: false,
- duration: o.duration,
- easing: o.easing,
- complete: function() {
- (mode == 'hide' && elem.hide());
- $.effects.restore( elem, props );
- (mode == 'show' && !$.support.opacity && this.style.removeAttribute( 'filter' ));
- jQuery.isFunction(o.complete) && o.complete.apply(this, arguments);
- elem.dequeue();
- }
- });
- });
+ $.effects.save( elem, props );
+
+ elem
+ .show()
+ .css({
+ backgroundImage: "none",
+ backgroundColor: o.color || "#ffff99"
+ })
+ .animate( animation, {
+ queue: false,
+ duration: o.duration,
+ easing: o.easing,
+ complete: function() {
+ (mode == "hide" && elem.hide());
+ $.effects.restore( elem, props );
+ (mode == "show" && !$.support.opacity && this.style.removeAttribute( "filter" ));
+ jQuery.isFunction(o.complete) && o.complete.apply(this, arguments);
+ next();
+ }
+ });
};
})(jQuery);
diff --git a/ui/jquery.effects.pulsate.js b/ui/jquery.effects.pulsate.js
index a0ddf51fd..bc257f624 100644
--- a/ui/jquery.effects.pulsate.js
+++ b/ui/jquery.effects.pulsate.js
@@ -12,56 +12,54 @@
*/
(function( $, undefined ) {
-$.effects.effect.pulsate = function( o ) {
- return this.queue( function( next ) {
- var elem = $( this ),
- mode = $.effects.setMode( elem, o.mode || "show" ),
- show = mode === "show",
- hide = mode === "hide",
- showhide = ( show || mode === "hide" ),
+$.effects.effect.pulsate = function( o, next ) {
+ var elem = $( this ),
+ mode = $.effects.setMode( elem, o.mode || "show" ),
+ show = mode === "show",
+ hide = mode === "hide",
+ showhide = ( show || mode === "hide" ),
- // showing or hiding leaves of the "last" animation
- anims = ( ( o.times || 5 ) * 2 ) + ( showhide ? 1 : 0 ),
- duration = o.duration / anims,
- animateTo = 0,
- queue = elem.queue(),
- queuelen = queue.length,
- i;
+ // showing or hiding leaves of the "last" animation
+ anims = ( ( o.times || 5 ) * 2 ) + ( showhide ? 1 : 0 ),
+ duration = o.duration / anims,
+ animateTo = 0,
+ queue = elem.queue(),
+ queuelen = queue.length,
+ i;
- if ( show || !elem.is(':visible')) {
- elem.css( "opacity", 0 ).show();
- animateTo = 1;
- }
-
- // anims - 1 opacity "toggles"
- for ( i = 1; i < anims; i++ ) {
- elem.animate({
- opacity: animateTo
- }, duration, o.easing );
- animateTo = 1 - animateTo;
- }
+ if ( show || !elem.is(":visible")) {
+ elem.css( "opacity", 0 ).show();
+ animateTo = 1;
+ }
+ // anims - 1 opacity "toggles"
+ for ( i = 1; i < anims; i++ ) {
elem.animate({
opacity: animateTo
- }, duration, o.easing);
+ }, duration, o.easing );
+ animateTo = 1 - animateTo;
+ }
- elem.queue( function( next ) {
- if ( hide ) {
- elem.hide();
- }
- if ( o.complete ) {
- o.complete.apply( this );
- }
- next();
- });
+ elem.animate({
+ opacity: animateTo
+ }, duration, o.easing);
- // We just queued up "anims" animations, we need to put them next in the queue
- if ( queuelen > 1) {
- queue.splice.apply( queue,
- [ 1, 0 ].concat( queue.splice( queuelen, anims + 1 ) ) );
+ elem.queue( function( next ) {
+ if ( hide ) {
+ elem.hide();
+ }
+ if ( o.complete ) {
+ o.complete.apply( this );
}
next();
});
+
+ // We just queued up "anims" animations, we need to put them next in the queue
+ if ( queuelen > 1 ) {
+ queue.splice.apply( queue,
+ [ 1, 0 ].concat( queue.splice( queuelen, anims + 1 ) ) );
+ }
+ next();
};
})(jQuery);
diff --git a/ui/jquery.effects.scale.js b/ui/jquery.effects.scale.js
index e00d82497..614943cfb 100644
--- a/ui/jquery.effects.scale.js
+++ b/ui/jquery.effects.scale.js
@@ -12,249 +12,255 @@
*/
(function( $, undefined ) {
-$.effects.effect.puff = function( o ) {
- return this.queue( function() {
- var elem = $( this ),
- mode = $.effects.setMode( elem, o.mode || 'hide' ),
- percent = parseInt( o.percent, 10 ) || 150,
- factor = percent / 100,
- original = {
- height: elem.height(),
- width: elem.width()
- };
-
- $.extend(o, {
- effect: 'scale',
- queue: false,
- fade: true,
- mode: mode,
- percent: mode == 'hide' ? percent : 100,
- from: mode == 'hide'
- ? original
- : {
- height: original.height * factor,
- width: original.width * factor
- }
- });
-
- elem.effect( o );
- });
-};
-
-$.effects.effect.scale = function( o ) {
-
- return this[ o.queue === false ? "each" : "queue" ]( function() {
-
- // Create element
- var el = $( this ),
- options = $.extend( true, {}, o ),
- mode = $.effects.setMode( el, o.mode || 'effect' ),
- percent = parseInt( o.percent, 10 ) || ( parseInt( o.percent, 10 ) == 0 ? 0 : ( mode == 'hide' ? 0 : 100 ) ),
- direction = o.direction || 'both',
- origin = o.origin,
- original = {
- height: el.height(),
- width: el.width(),
- outerHeight: el.outerHeight(),
- outerWidth: el.outerWidth()
- },
- factor = {
- y: direction != 'horizontal' ? (percent / 100) : 1,
- x: direction != 'vertical' ? (percent / 100) : 1
- };
-
- // We are going to pass this effect to the size effect:
- options.effect = "size";
- options.queue = false;
-
- // Set default origin and restore for show/hide
- if ( mode != 'effect' ) {
- options.origin = origin || ['middle','center'];
- options.restore = true;
+function compFunction( el, complete, next ) {
+ return function() {
+ if ( $.isFunction( complete ) ) {
+ complete.apply( el );
}
+ next();
+ };
+};
- options.from = o.from || ( mode == 'show' ? { height: 0, width: 0 } : original );
- options.to = {
- height: original.height * factor.y,
- width: original.width * factor.x,
- outerHeight: original.outerHeight * factor.y,
- outerWidth: original.outerWidth * factor.x
- };
-
- if ( options.fade ) { // Fade option to support puff
- if ( mode == 'show' ) {
- options.from.opacity = 0;
- options.to.opacity = 1;
- }
- if ( mode == 'hide' ) {
- options.from.opacity = 1;
- options.to.opacity = 0;
- }
+$.effects.effect.puff = function( o, next ) {
+ var elem = $( this ),
+ mode = $.effects.setMode( elem, o.mode || "hide" ),
+ percent = parseInt( o.percent, 10 ) || 150,
+ factor = percent / 100,
+ original = {
+ height: elem.height(),
+ width: elem.width()
};
- // Animate
- el.effect(options);
+ $.extend( o, {
+ effect: "scale",
+ queue: false,
+ fade: true,
+ mode: mode,
+ complete: compFunction( this, o.complete, next ),
+ percent: mode == "hide" ? percent : 100,
+ from: mode == "hide"
+ ? original
+ : {
+ height: original.height * factor,
+ width: original.width * factor
+ }
});
+ elem.effect( o );
};
-$.effects.effect.size = function( o ) {
-
- return this[ o.queue === false ? "each" : "queue" ]( function() {
- // Create element
- var el = $( this ),
- props = [ 'position', 'top', 'bottom', 'left', 'right', 'width', 'height', 'overflow', 'opacity' ],
-
- // Always restore
- props1 = [ 'position', 'top', 'bottom', 'left', 'right', 'overflow', 'opacity' ],
-
- // Copy for children
- props2 = [ 'width', 'height', 'overflow' ],
- cProps = [ 'fontSize' ],
- vProps = [ 'borderTopWidth', 'borderBottomWidth', 'paddingTop', 'paddingBottom' ],
- hProps = [ 'borderLeftWidth', 'borderRightWidth', 'paddingLeft', 'paddingRight' ],
-
- // Set options
- mode = $.effects.setMode( el, o.mode || 'effect' ),
- restore = o.restore || mode !== "effect",
- scale = o.scale || 'both',
- origin = o.origin || [ "middle", "center" ],
- original, baseline, factor,
- position = el.css( "position" ),
- originalVerticalPositioning = el.css( "bottom" ) !== "auto" ? "bottom" : "top";
- originalHorizontalPositioning = el.css( "right" ) !== "auto" ? "right" : "left";
-
- if ( mode === "show" ) {
- el.show();
- }
- original = {
+$.effects.effect.scale = function( o, next ) {
+
+ // Create element
+ var el = $( this ),
+ options = $.extend( true, {}, o ),
+ mode = $.effects.setMode( el, o.mode || "effect" ),
+ percent = parseInt( o.percent, 10 ) || ( parseInt( o.percent, 10 ) == 0 ? 0 : ( mode == "hide" ? 0 : 100 ) ),
+ direction = o.direction || "both",
+ origin = o.origin,
+ original = {
height: el.height(),
width: el.width(),
outerHeight: el.outerHeight(),
outerWidth: el.outerWidth()
- };
+ },
+ factor = {
+ y: direction != "horizontal" ? (percent / 100) : 1,
+ x: direction != "vertical" ? (percent / 100) : 1
+ };
- el.from = o.from || original;
- el.to = o.to || original;
+ // We are going to pass this effect to the size effect:
+ options.effect = "size";
+ options.queue = false;
+ options.complete = compFunction( this, options.complete, next );
+
+ // Set default origin and restore for show/hide
+ if ( mode != "effect" ) {
+ options.origin = origin || ["middle","center"];
+ options.restore = true;
+ }
+
+ options.from = o.from || ( mode == "show" ? { height: 0, width: 0 } : original );
+ options.to = {
+ height: original.height * factor.y,
+ width: original.width * factor.x,
+ outerHeight: original.outerHeight * factor.y,
+ outerWidth: original.outerWidth * factor.x
+ };
+
+ if ( options.fade ) { // Fade option to support puff
+ if ( mode == "show" ) {
+ options.from.opacity = 0;
+ options.to.opacity = 1;
+ }
+ if ( mode == "hide" ) {
+ options.from.opacity = 1;
+ options.to.opacity = 0;
+ }
+ };
- // Set scaling factor
- factor = {
- from: {
- y: el.from.height / original.height,
- x: el.from.width / original.width
- },
- to: {
- y: el.to.height / original.height,
- x: el.to.width / original.width
- }
- };
+ // Animate
+ el.effect( options );
- // Scale the css box
- if ( scale == 'box' || scale == 'both' ) {
+};
- // Vertical props scaling
- if ( factor.from.y !== factor.to.y ) {
- props = props.concat( vProps );
- el.from = $.effects.setTransition( el, vProps, factor.from.y, el.from );
- el.to = $.effects.setTransition( el, vProps, factor.to.y, el.to );
- };
+$.effects.effect.size = function( o, next ) {
+
+ // Create element
+ var el = $( this ),
+ props = [ "position", "top", "bottom", "left", "right", "width", "height", "overflow", "opacity" ],
+
+ // Always restore
+ props1 = [ "position", "top", "bottom", "left", "right", "overflow", "opacity" ],
+
+ // Copy for children
+ props2 = [ "width", "height", "overflow" ],
+ cProps = [ "fontSize" ],
+ vProps = [ "borderTopWidth", "borderBottomWidth", "paddingTop", "paddingBottom" ],
+ hProps = [ "borderLeftWidth", "borderRightWidth", "paddingLeft", "paddingRight" ],
+
+ // Set options
+ mode = $.effects.setMode( el, o.mode || "effect" ),
+ restore = o.restore || mode !== "effect",
+ scale = o.scale || "both",
+ origin = o.origin || [ "middle", "center" ],
+ original, baseline, factor,
+ position = el.css( "position" ),
+ originalVerticalPositioning = el.css( "bottom" ) !== "auto" ? "bottom" : "top";
+ originalHorizontalPositioning = el.css( "right" ) !== "auto" ? "right" : "left";
+
+ if ( mode === "show" ) {
+ el.show();
+ }
+ original = {
+ height: el.height(),
+ width: el.width(),
+ outerHeight: el.outerHeight(),
+ outerWidth: el.outerWidth()
+ };
+
+ el.from = o.from || original;
+ el.to = o.to || original;
+
+ // Set scaling factor
+ factor = {
+ from: {
+ y: el.from.height / original.height,
+ x: el.from.width / original.width
+ },
+ to: {
+ y: el.to.height / original.height,
+ x: el.to.width / original.width
+ }
+ };
- // Horizontal props scaling
- if ( factor.from.x !== factor.to.x ) {
- props = props.concat( hProps );
- el.from = $.effects.setTransition( el, hProps, factor.from.x, el.from );
- el.to = $.effects.setTransition( el, hProps, factor.to.x, el.to );
- };
+ // Scale the css box
+ if ( scale == "box" || scale == "both" ) {
+
+ // Vertical props scaling
+ if ( factor.from.y !== factor.to.y ) {
+ props = props.concat( vProps );
+ el.from = $.effects.setTransition( el, vProps, factor.from.y, el.from );
+ el.to = $.effects.setTransition( el, vProps, factor.to.y, el.to );
};
- // Scale the content
- if ( scale == 'content' || scale == 'both' ) {
+ // Horizontal props scaling
+ if ( factor.from.x !== factor.to.x ) {
+ props = props.concat( hProps );
+ el.from = $.effects.setTransition( el, hProps, factor.from.x, el.from );
+ el.to = $.effects.setTransition( el, hProps, factor.to.x, el.to );
+ };
+ };
- // Vertical props scaling
- if ( factor.from.y !== factor.to.y ) {
- props = props.concat( cProps );
- el.from = $.effects.setTransition( el, cProps, factor.from.y, el.from );
- el.to = $.effects.setTransition( el, cProps, factor.to.y, el.to );
- };
+ // Scale the content
+ if ( scale == "content" || scale == "both" ) {
+
+ // Vertical props scaling
+ if ( factor.from.y !== factor.to.y ) {
+ props = props.concat( cProps );
+ el.from = $.effects.setTransition( el, cProps, factor.from.y, el.from );
+ el.to = $.effects.setTransition( el, cProps, factor.to.y, el.to );
};
-
- $.effects.save( el, restore ? props : props1 );
- el.show();
- $.effects.createWrapper( el );
- el.css( 'overflow', 'hidden' ).css( el.from );
-
- // Adjust
- if (origin) { // Calculate baseline shifts
- baseline = $.effects.getBaseline( origin, original );
- el.from.top = ( original.outerHeight - el.outerHeight() ) * baseline.y;
- el.from.left = ( original.outerWidth - el.outerWidth() ) * baseline.x;
- el.to.top = ( original.outerHeight - el.to.outerHeight ) * baseline.y;
- el.to.left = ( original.outerWidth - el.to.outerWidth ) * baseline.x;
- }
- el.css( el.from ); // set top & left
-
- // Animate
- if ( scale == 'content' || scale == 'both' ) { // Scale the children
-
- // Add margins/font-size
- vProps = vProps.concat([ 'marginTop', 'marginBottom' ]).concat(cProps);
- hProps = hProps.concat([ 'marginLeft', 'marginRight' ]);
- props2 = props.concat(vProps).concat(hProps);
-
- el.find( "*[width]" ).each( function(){
- var child = $( this ),
- c_original = {
- height: child.height(),
- width: child.width()
- };
- if (restore) $.effects.save(child, props2);
-
- child.from = {
- height: c_original.height * factor.from.y,
- width: c_original.width * factor.from.x
- };
- child.to = {
- height: c_original.height * factor.to.y,
- width: c_original.width * factor.to.x
+ };
+
+ $.effects.save( el, restore ? props : props1 );
+ el.show();
+ $.effects.createWrapper( el );
+ el.css( "overflow", "hidden" ).css( el.from );
+
+ // Adjust
+ if (origin) { // Calculate baseline shifts
+ baseline = $.effects.getBaseline( origin, original );
+ el.from.top = ( original.outerHeight - el.outerHeight() ) * baseline.y;
+ el.from.left = ( original.outerWidth - el.outerWidth() ) * baseline.x;
+ el.to.top = ( original.outerHeight - el.to.outerHeight ) * baseline.y;
+ el.to.left = ( original.outerWidth - el.to.outerWidth ) * baseline.x;
+ }
+ el.css( el.from ); // set top & left
+
+ // Animate
+ if ( scale == "content" || scale == "both" ) { // Scale the children
+
+ // Add margins/font-size
+ vProps = vProps.concat([ "marginTop", "marginBottom" ]).concat(cProps);
+ hProps = hProps.concat([ "marginLeft", "marginRight" ]);
+ props2 = props.concat(vProps).concat(hProps);
+
+ el.find( "*[width]" ).each( function(){
+ var child = $( this ),
+ c_original = {
+ height: child.height(),
+ width: child.width()
};
+ if (restore) $.effects.save(child, props2);
+
+ child.from = {
+ height: c_original.height * factor.from.y,
+ width: c_original.width * factor.from.x
+ };
+ child.to = {
+ height: c_original.height * factor.to.y,
+ width: c_original.width * factor.to.x
+ };
- // Vertical props scaling
- if ( factor.from.y != factor.to.y ) {
- child.from = $.effects.setTransition( child, vProps, factor.from.y, child.from );
- child.to = $.effects.setTransition( child, vProps, factor.to.y, child.to );
- };
+ // Vertical props scaling
+ if ( factor.from.y != factor.to.y ) {
+ child.from = $.effects.setTransition( child, vProps, factor.from.y, child.from );
+ child.to = $.effects.setTransition( child, vProps, factor.to.y, child.to );
+ };
- // Horizontal props scaling
- if ( factor.from.x != factor.to.x ) {
- child.from = $.effects.setTransition( child, hProps, factor.from.x, child.from );
- child.to = $.effects.setTransition( child, hProps, factor.to.x, child.to );
- };
+ // Horizontal props scaling
+ if ( factor.from.x != factor.to.x ) {
+ child.from = $.effects.setTransition( child, hProps, factor.from.x, child.from );
+ child.to = $.effects.setTransition( child, hProps, factor.to.x, child.to );
+ };
- // Animate children
- child.css( child.from );
- child.animate( child.to, o.duration, o.easing, function() {
+ // Animate children
+ child.css( child.from );
+ child.animate( child.to, o.duration, o.easing, function() {
- // Restore children
- if (restore) $.effects.restore( child, props2 );
- });
+ // Restore children
+ if (restore) $.effects.restore( child, props2 );
});
- };
-
- // Animate
- el.animate( el.to, {
- queue: false,
- duration: o.duration,
- easing: o.easing,
- complete: function() {
- if ( el.to.opacity === 0 ) {
- el.css( 'opacity', el.from.opacity );
- }
- if( mode == 'hide' ) {
- el.hide();
- }
- $.effects.restore( el, restore ? props : props1 );
+ });
+ };
+
+ // Animate
+ el.animate( el.to, {
+ queue: false,
+ duration: o.duration,
+ easing: o.easing,
+ complete: function() {
+ if ( el.to.opacity === 0 ) {
+ el.css( "opacity", el.from.opacity );
+ }
+ if( mode == "hide" ) {
+ el.hide();
+ }
+ $.effects.restore( el, restore ? props : props1 );
+ if ( !restore ) {
- // we need to recalculate our positioning based on the new scaling
+ // we need to calculate our new positioning based on the scaling
if ( position === "static" ) {
el.css({
position: "relative",
@@ -292,13 +298,14 @@ $.effects.effect.size = function( o ) {
});
});
}
-
- $.effects.removeWrapper( el );
- $.isFunction( o.complete ) && o.complete.apply( this, arguments ); // Callback
- el.dequeue();
}
- });
+ $.effects.removeWrapper( el );
+ if ( $.isFunction( o.complete ) ) {
+ o.complete.apply( this, arguments );
+ }
+ next();
+ }
});
};
diff --git a/ui/jquery.effects.shake.js b/ui/jquery.effects.shake.js
index 52ab331e8..82d7ae97e 100644
--- a/ui/jquery.effects.shake.js
+++ b/ui/jquery.effects.shake.js
@@ -12,66 +12,63 @@
*/
(function( $, undefined ) {
-$.effects.effect.shake = function( o ) {
+$.effects.effect.shake = function( o, next ) {
- return this.queue( function() {
+ var el = $( this ),
+ props = [ "position", "top", "bottom", "left", "right", "height", "width" ],
+ mode = $.effects.setMode( el, o.mode || "effect" ),
+ direction = o.direction || "left",
+ distance = o.distance || 20,
+ times = o.times || 3,
+ anims = times * 2 + 1,
+ speed = o.duration,
+ ref = (direction == "up" || direction == "down") ? "top" : "left",
+ motion = (direction == "up" || direction == "left") ? "pos" : "neg",
+ animation = {},
+ animation1 = {},
+ animation2 = {},
+ i,
- var el = $( this ),
- props = [ "position", "top", "bottom", "left", "right", "height", "width" ],
- mode = $.effects.setMode( el, o.mode || "effect" ),
- direction = o.direction || "left",
- distance = o.distance || 20,
- times = o.times || 3,
- anims = times * 2 + 1,
- speed = o.duration,
- ref = (direction == "up" || direction == "down") ? "top" : "left",
- motion = (direction == "up" || direction == "left") ? "pos" : "neg",
- animation = {},
- animation1 = {},
- animation2 = {},
- i,
+ // we will need to re-assemble the queue to stack our animations in place
+ queue = el.queue(),
+ queuelen = queue.length;
+
- // we will need to re-assemble the queue to stack our animations in place
- queue = el.queue(),
- queuelen = queue.length;
-
+ $.effects.save( el, props );
+ el.show();
+ $.effects.createWrapper( el );
- $.effects.save( el, props );
- el.show();
- $.effects.createWrapper( el );
+ // Animation
+ animation[ ref ] = ( motion == "pos" ? "-=" : "+=" ) + distance;
+ animation1[ ref ] = ( motion == "pos" ? "+=" : "-=" ) + distance * 2;
+ animation2[ ref ] = ( motion == "pos" ? "-=" : "+=" ) + distance * 2;
- // Animation
- animation[ ref ] = ( motion == "pos" ? "-=" : "+=" ) + distance;
- animation1[ ref ] = ( motion == "pos" ? "+=" : "-=" ) + distance * 2;
- animation2[ ref ] = ( motion == "pos" ? "-=" : "+=" ) + distance * 2;
+ // Animate
+ el.animate( animation, speed, o.easing );
- // Animate
- el.animate( animation, speed, o.easing );
+ // Shakes
+ for ( i = 1; i < times; i++ ) {
+ el.animate( animation1, speed, o.easing ).animate( animation2, speed, o.easing );
+ };
+ el
+ .animate( animation1, speed, o.easing )
+ .animate( animation, speed / 2, o.easing )
+ .queue( function( next ) {
+ if ( mode === "hide" ) {
+ el.hide();
+ }
+ $.effects.restore( el, props );
+ $.effects.removeWrapper( el );
+ $.isFunction( o.complete ) && o.complete.apply( this, arguments );
+ next();
+ });
- // Shakes
- for ( i = 1; i < times; i++ ) {
- el.animate( animation1, speed, o.easing ).animate( animation2, speed, o.easing );
- };
- el
- .animate( animation1, speed, o.easing )
- .animate( animation, speed / 2, o.easing )
- .queue( function( next ) {
- if ( mode === "hide" ) {
- el.hide();
- }
- $.effects.restore( el, props );
- $.effects.removeWrapper( el );
- $.isFunction( o.complete ) && o.complete.apply( this, arguments );
- next();
- });
-
- // inject all the animations we just queued to be first in line (after "inprogress")
- if ( queuelen > 1) {
- queue.splice.apply( queue,
- [ 1, 0 ].concat( queue.splice( queuelen, anims + 1 ) ) );
- }
- el.dequeue();
- });
+ // inject all the animations we just queued to be first in line (after "inprogress")
+ if ( queuelen > 1) {
+ queue.splice.apply( queue,
+ [ 1, 0 ].concat( queue.splice( queuelen, anims + 1 ) ) );
+ }
+ next();
};
diff --git a/ui/jquery.effects.slide.js b/ui/jquery.effects.slide.js
index ccb13fa1b..7ed744284 100644
--- a/ui/jquery.effects.slide.js
+++ b/ui/jquery.effects.slide.js
@@ -12,58 +12,54 @@
*/
(function( $, undefined ) {
-$.effects.effect.slide = function( o ) {
+$.effects.effect.slide = function( o, next ) {
- return this.queue( function() {
+ // Create element
+ var el = $( this ),
+ props = [ "position", "top", "bottom", "left", "right", "width", "height" ],
+ mode = $.effects.setMode( el, o.mode || "show" ),
+ direction = o.direction || "left",
+ ref = (direction == "up" || direction == "down") ? "top" : "left",
+ motion = (direction == "up" || direction == "left") ? "pos" : "neg",
+ distance,
+ animation = {},
+ size;
- // Create element
- var el = $( this ),
- props = [ "position", "top", "bottom", "left", "right", "width", "height" ],
- mode = $.effects.setMode( el, o.mode || 'show' ),
- direction = o.direction || 'left',
- ref = (direction == 'up' || direction == 'down') ? 'top' : 'left',
- motion = (direction == 'up' || direction == 'left') ? 'pos' : 'neg',
- distance,
- animation = {},
- size;
-
- // Adjust
- $.effects.save( el, props );
- el.show();
- distance = o.distance || el[ ref == 'top' ? "outerHeight" : "outerWidth" ]({
- margin: true
- });
-
- $.effects.createWrapper( el ).css({
- overflow: 'hidden'
- });
-
- if (mode == 'show') {
- el.css( ref, motion == 'pos' ? (isNaN(distance) ? "-" + distance : -distance) : distance );
- }
+ // Adjust
+ $.effects.save( el, props );
+ el.show();
+ distance = o.distance || el[ ref == "top" ? "outerHeight" : "outerWidth" ]({
+ margin: true
+ });
+
+ $.effects.createWrapper( el ).css({
+ overflow: "hidden"
+ });
+
+ if (mode == "show") {
+ el.css( ref, motion == "pos" ? (isNaN(distance) ? "-" + distance : -distance) : distance );
+ }
- // Animation
- animation[ ref ] = ( mode == 'show' ?
- (motion == 'pos' ? '+=' : '-=') :
- (motion == 'pos' ? '-=' : '+='))
- + distance;
+ // Animation
+ animation[ ref ] = ( mode == "show" ?
+ (motion == "pos" ? "+=" : "-=") :
+ (motion == "pos" ? "-=" : "+="))
+ + distance;
- // Animate
- el.animate( animation, {
- queue: false,
- duration: o.duration,
- easing: o.easing,
- complete: function() {
- if ( mode == 'hide' ) {
- el.hide();
- }
- $.effects.restore( el, props );
- $.effects.removeWrapper( el );
- $.isFunction(o.complete) && o.complete.apply( this, arguments );
- el.dequeue();
+ // Animate
+ el.animate( animation, {
+ queue: false,
+ duration: o.duration,
+ easing: o.easing,
+ complete: function() {
+ if ( mode == "hide" ) {
+ el.hide();
}
- });
-
+ $.effects.restore( el, props );
+ $.effects.removeWrapper( el );
+ $.isFunction(o.complete) && o.complete.apply( this, arguments );
+ next();
+ }
});
};
diff --git a/ui/jquery.effects.transfer.js b/ui/jquery.effects.transfer.js
index f0f9d9fd4..061882fec 100644
--- a/ui/jquery.effects.transfer.js
+++ b/ui/jquery.effects.transfer.js
@@ -12,39 +12,36 @@
*/
(function( $, undefined ) {
-$.effects.effect.transfer = function( o ) {
-
- return this.queue( function() {
- var elem = $( this ),
- target = $( o.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 = elem.offset(),
- transfer = $( '<div class="ui-effects-transfer"></div>' )
- .appendTo( document.body )
- .addClass( o.className )
- .css({
- top: startPosition.top - fixTop ,
- left: startPosition.left - fixLeft ,
- height: elem.innerHeight(),
- width: elem.innerWidth(),
- position: targetFixed ? "fixed" : "absolute"
- })
- .animate( animation, o.duration, o.easing, function() {
- transfer.remove();
- $.isFunction( o.complete ) && o.complete.apply(elem[0], arguments);
- elem.dequeue();
- });
- });
+$.effects.effect.transfer = function( o, next ) {
+ var elem = $( this ),
+ target = $( o.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 = elem.offset(),
+ transfer = $( '<div class="ui-effects-transfer"></div>' )
+ .appendTo( document.body )
+ .addClass( o.className )
+ .css({
+ top: startPosition.top - fixTop ,
+ left: startPosition.left - fixLeft ,
+ height: elem.innerHeight(),
+ width: elem.innerWidth(),
+ position: targetFixed ? "fixed" : "absolute"
+ })
+ .animate( animation, o.duration, o.easing, function() {
+ transfer.remove();
+ $.isFunction( o.complete ) && o.complete.apply(elem[0], arguments);
+ next();
+ });
};
})(jQuery);