From 1c1a3b1a361d90a73755fbd038b3cdfb0960c29f Mon Sep 17 00:00:00 2001 From: gnarf Date: Tue, 21 Jun 2011 00:23:52 -0500 Subject: Effects.*: Updating Effect Method API to avoid duplicating the queue call - Fixes #7318 - Add the queue functions to $.fn.effect() --- ui/jquery.effects.blind.js | 112 ++++++++++++++++++++++----------------------- 1 file changed, 54 insertions(+), 58 deletions(-) (limited to 'ui/jquery.effects.blind.js') 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(); + } }); }; -- cgit v1.2.3