aboutsummaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authorJörn Zaefferer <joern.zaefferer@gmail.com>2011-07-28 15:16:20 +0200
committerJörn Zaefferer <joern.zaefferer@gmail.com>2011-07-28 15:16:20 +0200
commit5a45f483d73578dd147229d412998bba4a44c35b (patch)
tree540e9c5ca8502fa0277d072de973a9c676134793 /ui
parent5297b7bc4250462213b05ad2763fe99d0f8dedec (diff)
parent0ba493d3b4f9d6da35cadc499e9f7ebb6adb31b3 (diff)
downloadjquery-ui-5a45f483d73578dd147229d412998bba4a44c35b.tar.gz
jquery-ui-5a45f483d73578dd147229d412998bba4a44c35b.zip
Merge branch 'master' into widget-delegation
Diffstat (limited to 'ui')
-rw-r--r--ui/i18n/jquery.ui.datepicker-nl.js2
-rw-r--r--ui/jquery.effects.blind.js109
-rw-r--r--ui/jquery.effects.bounce.js185
-rw-r--r--ui/jquery.effects.clip.js90
-rw-r--r--ui/jquery.effects.core.js26
-rw-r--r--ui/jquery.effects.drop.js87
-rw-r--r--ui/jquery.effects.explode.js139
-rw-r--r--ui/jquery.effects.fade.js37
-rw-r--r--ui/jquery.effects.fold.js99
-rw-r--r--ui/jquery.effects.highlight.js60
-rw-r--r--ui/jquery.effects.pulsate.js83
-rw-r--r--ui/jquery.effects.scale.js438
-rw-r--r--ui/jquery.effects.shake.js102
-rw-r--r--ui/jquery.effects.slide.js90
-rw-r--r--ui/jquery.effects.transfer.js62
-rw-r--r--ui/jquery.ui.accordion.js47
-rw-r--r--ui/jquery.ui.autocomplete.js2
-rw-r--r--ui/jquery.ui.button.js20
-rw-r--r--ui/jquery.ui.datepicker.js31
-rw-r--r--ui/jquery.ui.dialog.js9
-rw-r--r--ui/jquery.ui.menu.js117
-rw-r--r--ui/jquery.ui.menubar.js61
-rw-r--r--ui/jquery.ui.popup.js10
-rw-r--r--ui/jquery.ui.position.js18
-rw-r--r--ui/jquery.ui.slider.js4
-rw-r--r--ui/jquery.ui.spinner.js6
-rw-r--r--ui/jquery.ui.tooltip.js11
27 files changed, 1018 insertions, 927 deletions
diff --git a/ui/i18n/jquery.ui.datepicker-nl.js b/ui/i18n/jquery.ui.datepicker-nl.js
index 09634088b..781fe6191 100644
--- a/ui/i18n/jquery.ui.datepicker-nl.js
+++ b/ui/i18n/jquery.ui.datepicker-nl.js
@@ -8,7 +8,7 @@ jQuery(function($){
currentText: 'Vandaag',
monthNames: ['januari', 'februari', 'maart', 'april', 'mei', 'juni',
'juli', 'augustus', 'september', 'oktober', 'november', 'december'],
- monthNamesShort: ['jan', 'feb', 'maa', 'apr', 'mei', 'jun',
+ monthNamesShort: ['jan', 'feb', 'mrt', 'apr', 'mei', 'jun',
'jul', 'aug', 'sep', 'okt', 'nov', 'dec'],
dayNames: ['zondag', 'maandag', 'dinsdag', 'woensdag', 'donderdag', 'vrijdag', 'zaterdag'],
dayNamesShort: ['zon', 'maa', 'din', 'woe', 'don', 'vri', 'zat'],
diff --git a/ui/jquery.effects.blind.js b/ui/jquery.effects.blind.js
index b6485b641..5f86bed7b 100644
--- a/ui/jquery.effects.blind.js
+++ b/ui/jquery.effects.blind.js
@@ -11,74 +11,67 @@
* jquery.effects.core.js
*/
(function( $, undefined ) {
-
-var rvertical = /up|down|vertical/;
-var rpositivemotion = /up|left|vertical|horizontal/;
-$.effects.effect.blind = function( o ) {
+var rvertical = /up|down|vertical/,
+ rpositivemotion = /up|left|vertical|horizontal/;
- return this.queue( function() {
+$.effects.effect.blind = function( o, done ) {
+ // 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;
- // 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 ] = show ? distance : 0;
+ if ( !motion ) {
+ el
+ .css( vertical ? "bottom" : "right", 0 )
+ .css( vertical ? "top" : "left", "" )
+ .css({ position: "absolute" });
+ animation[ ref2 ] = 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 ( 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();
}
+ $.effects.restore( el, props );
+ $.effects.removeWrapper( el );
+ done();
}
-
- // 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();
- }
- });
-
});
};
diff --git a/ui/jquery.effects.bounce.js b/ui/jquery.effects.bounce.js
index 78fedb0ce..41ee34f64 100644
--- a/ui/jquery.effects.bounce.js
+++ b/ui/jquery.effects.bounce.js
@@ -12,108 +12,101 @@
*/
(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, done ) {
+ 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() {
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 ) ) );
- }
- next();
-
+ $.effects.restore( el, props );
+ $.effects.removeWrapper( el );
+ done();
});
+ // 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();
+
};
})(jQuery);
diff --git a/ui/jquery.effects.clip.js b/ui/jquery.effects.clip.js
index dbf0d36c9..c6eecc671 100644
--- a/ui/jquery.effects.clip.js
+++ b/ui/jquery.effects.clip.js
@@ -12,61 +12,53 @@
*/
(function( $, undefined ) {
-$.effects.effect.clip = function( o ) {
+$.effects.effect.clip = function( o, done ) {
+ // 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 );
+ done();
+ }
});
};
diff --git a/ui/jquery.effects.core.js b/ui/jquery.effects.core.js
index 00a803360..b08cd6cf4 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,32 @@ $.fn.extend({
}
}
+ function run( next ) {
+ var elem = $( this ),
+ complete = args.complete,
+ mode = args.mode;
+
+ function done() {
+ if ( $.isFunction( complete ) ) {
+ complete.call( elem[0] );
+ }
+ if ( $.isFunction( next ) ) {
+ next();
+ }
+ }
+
+ // if the element is hiddden and mode is hide,
+ // or element is visible and mode is show
+ if ( elem.is( ":hidden" ) ? mode === "hide" : mode === "show" ) {
+ done();
+ } else {
+ effectMethod.call( elem[0], args, done );
+ }
+ }
+
// 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..2e7a6ec0f 100644
--- a/ui/jquery.effects.drop.js
+++ b/ui/jquery.effects.drop.js
@@ -12,51 +12,50 @@
*/
(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, done ) {
+
+ var el = $( this ),
+ props = [ "position", "top", "bottom", "left", "right", "opacity", "height", "width" ],
+ mode = $.effects.setMode( el, o.mode || "hide" ),
+ show = mode === "show",
+ direction = o.direction || "left",
+ ref = ( direction === "up" || direction === "down" ) ? "top" : "left",
+ motion = ( direction === "up" || direction === "left" ) ? "pos" : "neg",
+ animation = {
+ opacity: 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 ( show ) {
+ el
+ .css( "opacity", 0 )
+ .css( ref, motion == "pos" ? -distance : distance );
+ }
+
+ // Animation
+ animation[ ref ] = ( 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 );
+ done();
}
-
- // 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..22f506045 100644
--- a/ui/jquery.effects.explode.js
+++ b/ui/jquery.effects.explode.js
@@ -12,92 +12,85 @@
*/
(function( $, undefined ) {
-$.effects.effect.explode = function( o ) {
+$.effects.effect.explode = function( o, done ) {
- 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();
}
- });
-
+ done();
+ }
};
})(jQuery);
diff --git a/ui/jquery.effects.fade.js b/ui/jquery.effects.fade.js
index ff1cba5f8..9b79ad3bc 100644
--- a/ui/jquery.effects.fade.js
+++ b/ui/jquery.effects.fade.js
@@ -12,29 +12,24 @@
*/
(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, done ) {
+ 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();
}
- });
+ done();
+ }
});
};
diff --git a/ui/jquery.effects.fold.js b/ui/jquery.effects.fold.js
index 6100c33a1..7c4f583c1 100644
--- a/ui/jquery.effects.fold.js
+++ b/ui/jquery.effects.fold.js
@@ -12,61 +12,62 @@
*/
(function( $, undefined ) {
-$.effects.effect.fold = function( o ) {
+$.effects.effect.fold = function( o, done ) {
- return this.queue( function() {
+ // Create element
+ var el = $( this ),
+ props = [ "position", "top", "bottom", "left", "right", "height", "width" ],
+ mode = $.effects.setMode( el, o.mode || "hide" ),
+ show = mode === "show",
+ hide = mode === "hide",
+ size = o.size || 15,
+ percent = /([0-9]+)%/.exec( size ),
+ horizFirst = !!o.horizFirst,
+ widthFirst = show != horizFirst,
+ ref = widthFirst ? [ "width", "height" ] : [ "height", "width" ],
+ duration = o.duration / 2,
+ wrapper, distance,
+ animation1 = {}, animation2 = {};
- // 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[ hide ? 0 : 1 ];
+ }
+ if ( 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
+ animation1[ ref[ 0 ] ] = show ? distance[ 0 ] : size;
+ animation2[ ref[ 1 ] ] = show ? distance[ 1 ] : 0;
- });
+ // Animate
+ wrapper
+ .animate( animation1, duration, o.easing )
+ .animate( animation2, duration, o.easing, function() {
+ if ( hide ) {
+ el.hide();
+ }
+ $.effects.restore( el, props );
+ $.effects.removeWrapper( el );
+ done();
+ });
};
diff --git a/ui/jquery.effects.highlight.js b/ui/jquery.effects.highlight.js
index cd4f0705a..edde845a3 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, done ) {
+ 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() {
+ if ( mode === "hide" ) {
+ elem.hide();
}
- });
- });
+ $.effects.restore( elem, props );
+ done();
+ }
+ });
};
})(jQuery);
diff --git a/ui/jquery.effects.pulsate.js b/ui/jquery.effects.pulsate.js
index a0ddf51fd..7d6e9328f 100644
--- a/ui/jquery.effects.pulsate.js
+++ b/ui/jquery.effects.pulsate.js
@@ -12,56 +12,51 @@
*/
(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" ),
-
- // 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;
- }
-
+$.effects.effect.pulsate = function( o, done ) {
+ 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;
+
+ 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() {
+ if ( hide ) {
+ elem.hide();
}
- next();
+ done();
});
+
+ // 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.dequeue();
};
})(jQuery);
diff --git a/ui/jquery.effects.scale.js b/ui/jquery.effects.scale.js
index e00d82497..000fdee28 100644
--- a/ui/jquery.effects.scale.js
+++ b/ui/jquery.effects.scale.js
@@ -12,249 +12,247 @@
*/
(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
- }
- });
+$.effects.effect.puff = function( o, done ) {
+ var elem = $( this ),
+ mode = $.effects.setMode( elem, o.mode || "hide" ),
+ hide = mode === "hide",
+ percent = parseInt( o.percent, 10 ) || 150,
+ factor = percent / 100,
+ original = {
+ height: elem.height(),
+ width: elem.width()
+ };
- elem.effect( o );
+ $.extend( o, {
+ effect: "scale",
+ queue: false,
+ fade: true,
+ mode: mode,
+ complete: done,
+ percent: hide ? percent : 100,
+ from: 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;
- }
+$.effects.effect.scale = function( o, done ) {
- 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
+ // 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
};
- 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;
- }
- };
+ // We are going to pass this effect to the size effect:
+ options.effect = "size";
+ options.queue = false;
+ options.complete = done;
+
+ // 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;
+ }
+ };
- // Animate
- el.effect(options);
- });
+ // Animate
+ el.effect( options );
};
-$.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();
+$.effects.effect.size = function( o, done ) {
+
+ // 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
}
- original = {
- height: el.height(),
- width: el.width(),
- outerHeight: el.outerHeight(),
- outerWidth: el.outerWidth()
- };
+ };
- el.from = o.from || original;
- el.to = o.to || original;
+ // Scale the css box
+ if ( scale == "box" || scale == "both" ) {
- // 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
- }
+ // 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 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 );
- };
-
- // 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 );
- };
+ // 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 content
- if ( scale == 'content' || scale == 'both' ) {
+ // 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 );
- };
+ // 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 +290,11 @@ $.effects.effect.size = function( o ) {
});
});
}
-
- $.effects.removeWrapper( el );
- $.isFunction( o.complete ) && o.complete.apply( this, arguments ); // Callback
- el.dequeue();
}
- });
+ $.effects.removeWrapper( el );
+ done();
+ }
});
};
diff --git a/ui/jquery.effects.shake.js b/ui/jquery.effects.shake.js
index 52ab331e8..7d83a9bb8 100644
--- a/ui/jquery.effects.shake.js
+++ b/ui/jquery.effects.shake.js
@@ -12,66 +12,62 @@
*/
(function( $, undefined ) {
-$.effects.effect.shake = function( o ) {
+$.effects.effect.shake = function( o, done ) {
- 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",
+ positiveMotion = (direction == "up" || direction == "left"),
+ 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 ] = ( positiveMotion ? "-=" : "+=" ) + distance;
+ animation1[ ref ] = ( positiveMotion ? "+=" : "-=" ) + distance * 2;
+ animation2[ ref ] = ( positiveMotion ? "-=" : "+=" ) + 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() {
+ if ( mode === "hide" ) {
+ el.hide();
+ }
+ $.effects.restore( el, props );
+ $.effects.removeWrapper( el );
+ done();
+ });
- // 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 ) ) );
+ }
+ el.dequeue();
};
diff --git a/ui/jquery.effects.slide.js b/ui/jquery.effects.slide.js
index ccb13fa1b..de393c779 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, done ) {
- return this.queue( function() {
+ // Create element
+ var el = $( this ),
+ props = [ "position", "top", "bottom", "left", "right", "width", "height" ],
+ mode = $.effects.setMode( el, o.mode || "show" ),
+ show = mode === "show",
+ direction = o.direction || "left",
+ ref = (direction == "up" || direction == "down") ? "top" : "left",
+ positiveMotion = (direction == "up" || direction == "left"),
+ 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 ( show ) {
+ el.css( ref, positiveMotion ? (isNaN(distance) ? "-" + distance : -distance) : distance );
+ }
- // Animation
- animation[ ref ] = ( mode == 'show' ?
- (motion == 'pos' ? '+=' : '-=') :
- (motion == 'pos' ? '-=' : '+='))
- + distance;
+ // Animation
+ animation[ ref ] = ( show ?
+ ( positiveMotion ? "+=" : "-=") :
+ ( positiveMotion ? "-=" : "+="))
+ + 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 );
+ done();
+ }
});
};
diff --git a/ui/jquery.effects.transfer.js b/ui/jquery.effects.transfer.js
index f0f9d9fd4..1fa291228 100644
--- a/ui/jquery.effects.transfer.js
+++ b/ui/jquery.effects.transfer.js
@@ -12,39 +12,35 @@
*/
(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, done ) {
+ 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();
+ done();
+ });
};
})(jQuery);
diff --git a/ui/jquery.ui.accordion.js b/ui/jquery.ui.accordion.js
index 7602ae9bc..c976e3e69 100644
--- a/ui/jquery.ui.accordion.js
+++ b/ui/jquery.ui.accordion.js
@@ -12,6 +12,8 @@
* jquery.ui.widget.js
*/
(function( $, undefined ) {
+
+var lastToggle = {};
// TODO: use ui-accordion-header-active class and fix styling
$.widget( "ui.accordion", {
@@ -37,8 +39,6 @@ $.widget( "ui.accordion", {
var self = this,
options = self.options;
- self.running = false;
-
self.element.addClass( "ui-accordion ui-widget ui-helper-reset" );
self.headers = self.element.find( options.header )
@@ -90,12 +90,11 @@ $.widget( "ui.accordion", {
if ( !self.active.length ) {
self.headers.eq( 0 ).attr( "tabIndex", 0 );
} else {
- self.active
- .attr({
- "aria-expanded": "true",
- "aria-selected": "true",
- tabIndex: 0
- });
+ self.active.attr({
+ "aria-expanded": "true",
+ "aria-selected": "true",
+ tabIndex: 0
+ });
}
// only need links in tab order for Safari
@@ -162,6 +161,13 @@ $.widget( "ui.accordion", {
return;
}
+ if ( key === "event" ) {
+ if ( this.options.event ) {
+ this.headers.unbind( this.options.event + ".accordion", this._eventHandler );
+ }
+ this._setupEvents( value );
+ }
+
this._super( "_setOption", key, value );
// setting collapsible: false while collapsed; open first panel
@@ -169,10 +175,6 @@ $.widget( "ui.accordion", {
this._activate( 0 );
}
- if ( key === "event" ) {
- this._setupEvents( value );
- }
-
if ( key === "icons" ) {
this._destroyIcons();
if ( value ) {
@@ -294,7 +296,6 @@ $.widget( "ui.accordion", {
},
_setupEvents: function( event ) {
- this.headers.unbind( ".accordion" );
if ( event ) {
this.headers.bind( event.split( " " ).join( ".accordion " ) + ".accordion",
$.proxy( this, "_eventHandler" ) );
@@ -319,8 +320,6 @@ $.widget( "ui.accordion", {
event.preventDefault();
if ( options.disabled ||
- // can't switch during an animation
- this.running ||
// click on active header, but not collapsible
( clickedIsActive && !options.collapsible ) ||
// allow canceling activation
@@ -361,7 +360,6 @@ $.widget( "ui.accordion", {
toShow = data.newContent,
toHide = data.oldContent;
- self.running = true;
function complete() {
self._completed( data );
}
@@ -382,6 +380,8 @@ $.widget( "ui.accordion", {
animations[ animation ]({
toShow: toShow,
toHide: toHide,
+ prevShow: lastToggle.toShow,
+ prevHide: lastToggle.toHide,
complete: complete,
down: toShow.length && ( !toHide.length || ( toShow.index() < toHide.index() ) )
}, additional );
@@ -412,8 +412,6 @@ $.widget( "ui.accordion", {
var toShow = data.newContent,
toHide = data.oldContent;
- this.running = false;
-
if ( this.options.heightStyle === "content" ) {
toShow.add( toHide ).css({
height: "",
@@ -435,6 +433,11 @@ $.widget( "ui.accordion", {
$.extend( $.ui.accordion, {
animations: {
slide: function( options, additions ) {
+ if ( options.prevShow || options.prevHide ) {
+ options.prevHide.stop( true, true );
+ options.toHide = options.prevShow;
+ }
+
var showOverflow = options.toShow.css( "overflow" ),
hideOverflow = options.toHide.css( "overflow" ),
percentDone = 0,
@@ -446,6 +449,9 @@ $.extend( $.ui.accordion, {
easing: "swing",
duration: 300
}, options, additions );
+
+ lastToggle = options;
+
if ( !options.toHide.size() ) {
originalWidth = options.toShow[0].style.width;
options.toShow
@@ -502,10 +508,7 @@ $.extend( $.ui.accordion, {
.filter( ":visible" )
.animate( hideProps, {
step: function( now, settings ) {
- // only calculate the percent when animating height
- // IE gets very inconsistent results when animating elements
- // with small values, which is common for padding
- if ( settings.prop == "height" ) {
+ if ( settings.prop == "height" || settings.prop == "paddingTop" || settings.prop == "paddingBottom" ) {
percentDone = ( settings.end - settings.start === 0 ) ? 0 :
( settings.now - settings.start ) / ( settings.end - settings.start );
}
diff --git a/ui/jquery.ui.autocomplete.js b/ui/jquery.ui.autocomplete.js
index e39b4649e..59caf625d 100644
--- a/ui/jquery.ui.autocomplete.js
+++ b/ui/jquery.ui.autocomplete.js
@@ -63,7 +63,7 @@ $.widget( "ui.autocomplete", {
"aria-haspopup": "true"
})
.bind( "keydown.autocomplete", function( event ) {
- if ( self.options.disabled || self.element.attr( "readonly" ) ) {
+ if ( self.options.disabled || self.element.prop( "readonly" ) ) {
suppressKeyPress = true;
suppressInput = true;
return;
diff --git a/ui/jquery.ui.button.js b/ui/jquery.ui.button.js
index 482cdc24c..ad17ab0c1 100644
--- a/ui/jquery.ui.button.js
+++ b/ui/jquery.ui.button.js
@@ -58,7 +58,7 @@ $.widget( "ui.button", {
.bind( "reset.button", formResetHandler );
if ( typeof this.options.disabled !== "boolean" ) {
- this.options.disabled = this.element.attr( "disabled" );
+ this.options.disabled = this.element.prop( "disabled" );
}
this._determineButtonType();
@@ -155,7 +155,7 @@ $.widget( "ui.button", {
return false;
}
$( this ).addClass( "ui-state-active" );
- self.buttonElement.attr( "aria-pressed", true );
+ self.buttonElement.attr( "aria-pressed", "true" );
var radio = self.element[ 0 ];
radioGroup( radio )
@@ -164,7 +164,7 @@ $.widget( "ui.button", {
return $( this ).button( "widget" )[ 0 ];
})
.removeClass( "ui-state-active" )
- .attr( "aria-pressed", false );
+ .attr( "aria-pressed", "false" );
});
} else {
this.buttonElement
@@ -244,7 +244,7 @@ $.widget( "ui.button", {
if ( checked ) {
this.buttonElement.addClass( "ui-state-active" );
}
- this.buttonElement.attr( "aria-pressed", checked );
+ this.buttonElement.prop( "aria-pressed", checked );
} else {
this.buttonElement = this.element;
}
@@ -272,9 +272,9 @@ $.widget( "ui.button", {
this._super( "_setOption", key, value );
if ( key === "disabled" ) {
if ( value ) {
- this.element.attr( "disabled", true );
+ this.element.prop( "disabled", true );
} else {
- this.element.removeAttr( "disabled" );
+ this.element.prop( "disabled", false );
}
return;
}
@@ -291,22 +291,22 @@ $.widget( "ui.button", {
if ( $( this ).is( ":checked" ) ) {
$( this ).button( "widget" )
.addClass( "ui-state-active" )
- .attr( "aria-pressed", true );
+ .attr( "aria-pressed", "true" );
} else {
$( this ).button( "widget" )
.removeClass( "ui-state-active" )
- .attr( "aria-pressed", false );
+ .attr( "aria-pressed", "false" );
}
});
} else if ( this.type === "checkbox" ) {
if ( this.element.is( ":checked" ) ) {
this.buttonElement
.addClass( "ui-state-active" )
- .attr( "aria-pressed", true );
+ .attr( "aria-pressed", "true" );
} else {
this.buttonElement
.removeClass( "ui-state-active" )
- .attr( "aria-pressed", false );
+ .attr( "aria-pressed", "false" );
}
}
},
diff --git a/ui/jquery.ui.datepicker.js b/ui/jquery.ui.datepicker.js
index ee0a86338..9f7f0b6e1 100644
--- a/ui/jquery.ui.datepicker.js
+++ b/ui/jquery.ui.datepicker.js
@@ -285,7 +285,9 @@ $.extend(Datepicker.prototype, {
if( inst.settings.disabled ) {
this._disableDatepicker( target );
}
- inst.dpDiv.show();
+ // Set display:block in place of inst.dpDiv.show() which won't work on disconnected elements
+ // http://bugs.jqueryui.com/ticket/7552 - A Datepicker created on a detached div has zero height
+ inst.dpDiv.css( "display", "block" );
},
/* Pop-up the date picker in a "dialog" box.
@@ -377,7 +379,7 @@ $.extend(Datepicker.prototype, {
var inline = $target.children('.' + this._inlineClass);
inline.children().removeClass('ui-state-disabled');
inline.find("select.ui-datepicker-month, select.ui-datepicker-year").
- removeAttr("disabled");
+ prop("disabled", false);
}
this._disabledInputs = $.map(this._disabledInputs,
function(value) { return (value == target ? null : value); }); // delete entry
@@ -402,7 +404,7 @@ $.extend(Datepicker.prototype, {
var inline = $target.children('.' + this._inlineClass);
inline.children().addClass('ui-state-disabled');
inline.find("select.ui-datepicker-month, select.ui-datepicker-year").
- attr("disabled", "disabled");
+ prop("disabled", true);
}
this._disabledInputs = $.map(this._disabledInputs,
function(value) { return (value == target ? null : value); }); // delete entry
@@ -529,6 +531,13 @@ $.extend(Datepicker.prototype, {
$.datepicker._currentClass + ')', inst.dpDiv);
if (sel[0])
$.datepicker._selectDay(event.target, inst.selectedMonth, inst.selectedYear, sel[0]);
+ var onSelect = $.datepicker._get(inst, 'onSelect');
+ if (onSelect) {
+ var dateStr = $.datepicker._formatDate(inst);
+
+ // trigger custom callback
+ onSelect.apply((inst.input ? inst.input[0] : null), [dateStr, inst]);
+ }
else
$.datepicker._hideDatepicker();
return false; // don't submit the form
@@ -932,8 +941,7 @@ $.extend(Datepicker.prototype, {
else {
this._hideDatepicker();
this._lastInput = inst.input[0];
- if (typeof(inst.input[0]) != 'object')
- inst.input.focus(); // restore focus
+ inst.input.focus(); // restore focus
this._lastInput = null;
}
},
@@ -1096,7 +1104,10 @@ $.extend(Datepicker.prototype, {
}
}
if (iValue < value.length){
- throw "Extra/unparsed characters found in date: " + value.substring(iValue);
+ var extra = value.substr(iValue);
+ if (!/^\s+/.test(extra)) {
+ throw "Extra/unparsed characters found in date: " + extra;
+ }
}
if (year == -1)
year = new Date().getFullYear();
@@ -1393,6 +1404,14 @@ $.extend(Datepicker.prototype, {
if (inst.input) {
inst.input.val(clear ? '' : this._formatDate(inst));
}
+
+ var onSelect = this._get(inst, 'onSelect');
+ if (onSelect) {
+ var dateStr = this._formatDate(inst);
+
+ // trigger custom callback
+ onSelect.apply((inst.input ? inst.input[0] : null), [dateStr, inst]);
+ }
},
/* Retrieve the date(s) directly. */
diff --git a/ui/jquery.ui.dialog.js b/ui/jquery.ui.dialog.js
index 0eba39842..493ed07e6 100644
--- a/ui/jquery.ui.dialog.js
+++ b/ui/jquery.ui.dialog.js
@@ -108,7 +108,8 @@ $.widget("ui.dialog", {
})
.mousedown(function( event ) {
self.moveToTop( false, event );
- }),
+ })
+ .appendTo( "body" ),
uiDialogContent = self.element
.show()
@@ -155,8 +156,6 @@ $.widget("ui.dialog", {
self._createButtons( options.buttons );
self._isOpen = false;
- uiDialog.appendTo( document.body );
-
if ( $.fn.bgiframe ) {
uiDialog.bgiframe();
}
@@ -266,8 +265,8 @@ $.widget("ui.dialog", {
// Opera 9.5+ resets when parent z-index is changed.
// http://bugs.jqueryui.com/ticket/3193
saveScroll = {
- scrollTop: self.element.attr( "scrollTop" ),
- scrollLeft: self.element.attr( "scrollLeft" )
+ scrollTop: self.element.scrollTop(),
+ scrollLeft: self.element.scrollLeft()
};
$.ui.dialog.maxZ += 1;
self.uiDialog.css( "z-index", $.ui.dialog.maxZ );
diff --git a/ui/jquery.ui.menu.js b/ui/jquery.ui.menu.js
index 7dd1a9ce0..c55ae75c9 100644
--- a/ui/jquery.ui.menu.js
+++ b/ui/jquery.ui.menu.js
@@ -58,6 +58,8 @@ $.widget( "ui.menu", {
}
var target = $( event.target ).closest( ".ui-menu-item" );
if ( target.length ) {
+ //Remove ui-state-active class from siblings of the newly focused menu item to avoid a jump caused by adjacent elements both having a class with a border
+ target.siblings().children( ".ui-state-active" ).removeClass( "ui-state-active" );
self.focus( event, target );
}
})
@@ -69,6 +71,18 @@ $.widget( "ui.menu", {
if ( target.length ) {
self.blur( event );
}
+ })
+ .bind( "focus.menu", function( event ) {
+ if ( self.options.disabled ) {
+ return;
+ }
+ self.focus( event, $( event.target ).children( ".ui-menu-item:first" ) );
+ })
+ .bind( "blur.menu", function( event ) {
+ if ( self.options.disabled ) {
+ return;
+ }
+ self.collapseAll( event );
});
this.refresh();
@@ -87,6 +101,16 @@ $.widget( "ui.menu", {
event.preventDefault();
event.stopImmediatePropagation();
break;
+ case $.ui.keyCode.HOME:
+ self._move( "first", "first", event );
+ event.preventDefault();
+ event.stopImmediatePropagation();
+ break;
+ case $.ui.keyCode.END:
+ self._move( "last", "last", event );
+ event.preventDefault();
+ event.stopImmediatePropagation();
+ break;
case $.ui.keyCode.UP:
self.previous( event );
event.preventDefault();
@@ -98,20 +122,20 @@ $.widget( "ui.menu", {
event.stopImmediatePropagation();
break;
case $.ui.keyCode.LEFT:
- if (self.left( event )) {
+ if (self.collapse( event )) {
event.stopImmediatePropagation();
}
event.preventDefault();
break;
case $.ui.keyCode.RIGHT:
- if (self.right( event )) {
+ if (self.expand( event )) {
event.stopImmediatePropagation();
}
event.preventDefault();
break;
case $.ui.keyCode.ENTER:
if ( self.active.children( "a[aria-haspopup='true']" ).length ) {
- if ( self.right( event ) ) {
+ if ( self.expand( event ) ) {
event.stopImmediatePropagation();
}
}
@@ -122,7 +146,7 @@ $.widget( "ui.menu", {
event.preventDefault();
break;
case $.ui.keyCode.ESCAPE:
- if ( self.left( event ) ) {
+ if ( self.collapse( event ) ) {
event.stopImmediatePropagation();
}
event.preventDefault();
@@ -170,6 +194,14 @@ $.widget( "ui.menu", {
}
}
});
+
+ this._bind( document, {
+ click: function( event ) {
+ if ( !$( event.target ).closest( ".ui-menu" ).length ) {
+ this.collapseAll( event );
+ }
+ }
+ });
},
_destroy: function() {
@@ -239,20 +271,20 @@ $.widget( "ui.menu", {
var nested,
self = this;
- this.blur();
+ this.blur( event );
if ( this._hasScroll() ) {
- var borderTop = parseFloat( $.curCSS( this.element[0], "borderTopWidth", true ) ) || 0,
- paddingTop = parseFloat( $.curCSS( this.element[0], "paddingTop", true ) ) || 0,
- offset = item.offset().top - this.element.offset().top - borderTop - paddingTop,
- scroll = this.element.scrollTop(),
- elementHeight = this.element.height(),
+ var borderTop = parseFloat( $.curCSS( this.activeMenu[0], "borderTopWidth", true ) ) || 0,
+ paddingTop = parseFloat( $.curCSS( this.activeMenu[0], "paddingTop", true ) ) || 0,
+ offset = item.offset().top - this.activeMenu.offset().top - borderTop - paddingTop,
+ scroll = this.activeMenu.scrollTop(),
+ elementHeight = this.activeMenu.height(),
itemHeight = item.height();
if ( offset < 0 ) {
- this.element.scrollTop( scroll + offset );
+ this.activeMenu.scrollTop( scroll + offset );
} else if ( offset + itemHeight > elementHeight ) {
- this.element.scrollTop( scroll + offset - elementHeight + itemHeight );
+ this.activeMenu.scrollTop( scroll + offset - elementHeight + itemHeight );
}
}
@@ -287,10 +319,19 @@ $.widget( "ui.menu", {
this.active.children( "a" ).removeClass( "ui-state-focus" );
this.active = null;
+
+ this._trigger( "blur", event, { item: this.active } );
},
_startOpening: function( submenu ) {
clearTimeout( this.timer );
+
+ // Don't open if already open fixes a Firefox bug that caused a .5 pixel
+ // shift in the submenu position when mousing over the carat icon
+ if ( submenu.attr( "aria-hidden" ) !== "true" ) {
+ return;
+ }
+
var self = this;
self.timer = setTimeout( function() {
self._close();
@@ -319,7 +360,7 @@ $.widget( "ui.menu", {
.position( position );
},
- closeAll: function() {
+ collapseAll: function( event ) {
this.element
.find( "ul" )
.hide()
@@ -329,7 +370,7 @@ $.widget( "ui.menu", {
.find( "a.ui-state-active" )
.removeClass( "ui-state-active" );
- this.blur();
+ this.blur( event );
this.activeMenu = this.element;
},
@@ -344,7 +385,7 @@ $.widget( "ui.menu", {
.removeClass( "ui-state-active" );
},
- left: function( event ) {
+ collapse: function( event ) {
var newItem = this.active && this.active.parents("li:not(.ui-menubar-item)").first();
if ( newItem && newItem.length ) {
this.active.parent()
@@ -356,7 +397,7 @@ $.widget( "ui.menu", {
}
},
- right: function( event ) {
+ expand: function( event ) {
var self = this,
newItem = this.active && this.active.children("ul").children("li").first();
@@ -372,11 +413,11 @@ $.widget( "ui.menu", {
},
next: function(event) {
- this._move( "next", ".ui-menu-item", "first", event );
+ this._move( "next", "first", event );
},
previous: function(event) {
- this._move( "prev", ".ui-menu-item", "last", event );
+ this._move( "prev", "last", event );
},
first: function() {
@@ -387,25 +428,36 @@ $.widget( "ui.menu", {
return this.active && !this.active.nextAll( ".ui-menu-item" ).length;
},
- _move: function( direction, edge, filter, event ) {
+ _move: function( direction, filter, event ) {
if ( !this.active ) {
- this.focus( event, this.activeMenu.children( edge )[ filter ]() );
+ this.focus( event, this.activeMenu.children( ".ui-menu-item" )[ filter ]() );
return;
}
- var next = this.active[ direction + "All" ]( ".ui-menu-item" ).eq( 0 );
+
+ var next;
+ if ( direction === "first" || direction === "last" ) {
+ next = this.active[ direction === "first" ? "prevAll" : "nextAll" ]( ".ui-menu-item" ).eq( -1 );
+ } else {
+ next = this.active[ direction + "All" ]( ".ui-menu-item" ).eq( 0 );
+ }
+
if ( next.length ) {
this.focus( event, next );
} else {
- this.focus( event, this.activeMenu.children( edge )[ filter ]() );
+ this.focus( event, this.activeMenu.children( ".ui-menu-item" )[ filter ]() );
}
},
nextPage: function( event ) {
if ( this._hasScroll() ) {
- if ( !this.active || this.last() ) {
+ if ( !this.active ) {
this.focus( event, this.activeMenu.children( ".ui-menu-item" ).first() );
return;
}
+ if ( this.last() ) {
+ return;
+ }
+
var base = this.active.offset().top,
height = this.element.height(),
result;
@@ -417,14 +469,17 @@ $.widget( "ui.menu", {
this.focus( event, result );
} else {
this.focus( event, this.activeMenu.children( ".ui-menu-item" )
- [ !this.active || this.last() ? "first" : "last" ]() );
+ [ !this.active ? "first" : "last" ]() );
}
},
previousPage: function( event ) {
if ( this._hasScroll() ) {
- if ( !this.active || this.first() ) {
- this.focus( event, this.activeMenu.children( ".ui-menu-item" ).last() );
+ if ( !this.active ) {
+ this.focus( event, this.activeMenu.children( ".ui-menu-item" ).first() );
+ return;
+ }
+ if ( this.first() ) {
return;
}
@@ -438,22 +493,20 @@ $.widget( "ui.menu", {
this.focus( event, result );
} else {
- this.focus( event, this.activeMenu.children( ".ui-menu-item" )
- [ !this.active || this.first() ? ":last" : ":first" ]() );
+ this.focus( event, this.activeMenu.children( ".ui-menu-item" ).first() );
}
},
_hasScroll: function() {
- // TODO: just use .prop() when we drop support for jQuery <1.6
- return this.element.height() < this.element[ $.fn.prop ? "prop" : "attr" ]( "scrollHeight" );
+ return this.element.height() < this.element.prop( "scrollHeight" );
},
select: function( event ) {
- // save active reference before closeAll triggers blur
+ // save active reference before collapseAll triggers blur
var ui = {
item: this.active
};
- this.closeAll();
+ this.collapseAll( event );
this._trigger( "select", event, ui );
}
});
diff --git a/ui/jquery.ui.menubar.js b/ui/jquery.ui.menubar.js
index 39e75924e..9af3aa080 100644
--- a/ui/jquery.ui.menubar.js
+++ b/ui/jquery.ui.menubar.js
@@ -20,6 +20,7 @@
$.widget( "ui.menubar", {
version: "@VERSION",
options: {
+ autoExpand: false,
buttons: false,
menuIcon: false,
position: {
@@ -48,15 +49,17 @@ $.widget( "ui.menubar", {
},
select: function( event, ui ) {
ui.item.parents( "ul.ui-menu:last" ).hide();
- that._trigger( "select", event, ui );
that._close();
// TODO what is this targetting? there's probably a better way to access it
$(event.target).prev().focus();
+ that._trigger( "select", event, ui );
}
})
.hide()
- .attr( "aria-hidden", "true" )
- .attr( "aria-expanded", "false" )
+ .attr({
+ "aria-hidden": "true",
+ "aria-expanded": "false"
+ })
.bind( "keydown.menubar", function( event ) {
var menu = $( this );
if ( menu.is( ":hidden" ) )
@@ -89,7 +92,11 @@ $.widget( "ui.menubar", {
that._close();
return;
}
- if ( ( that.open && event.type == "mouseenter" ) || event.type == "click" ) {
+ if ( ( that.open && event.type == "mouseenter" ) || event.type == "click" || that.options.autoExpand ) {
+ if( that.options.autoExpand ) {
+ clearTimeout( that.timer );
+ }
+
that._open( event, menu );
}
})
@@ -116,6 +123,22 @@ $.widget( "ui.menubar", {
.attr( "aria-haspopup", "true" )
.wrapInner( "<span class='ui-button-text'></span>" );
+ if ( that.options.autoExpand ) {
+ input.bind( "mouseleave.menubar", function( event ) {
+ that.timer = setTimeout( function() {
+ that._close();
+ }, 150 );
+ });
+ menu.bind( "mouseleave.menubar", function( event ) {
+ that.timer = setTimeout( function() {
+ that._close();
+ }, 150 );
+ })
+ .bind( "mouseenter.menubar", function( event ) {
+ clearTimeout( that.timer );
+ });
+ }
+
// TODO review if these options are a good choice, maybe they can be merged
if ( that.options.menuIcon ) {
input.addClass( "ui-state-default" ).append( "<span class='ui-button-icon-secondary ui-icon ui-icon-triangle-1-s'></span>" );
@@ -130,7 +153,7 @@ $.widget( "ui.menubar", {
});
that._bind( {
keydown: function( event ) {
- if ( event.keyCode == $.ui.keyCode.ESCAPE && that.active && that.active.menu( "left", event ) !== true ) {
+ if ( event.keyCode == $.ui.keyCode.ESCAPE && that.active && that.active.menu( "collapse", event ) !== true ) {
var active = that.active;
that.active.blur();
that._close( event );
@@ -151,19 +174,19 @@ $.widget( "ui.menubar", {
_destroy : function() {
var items = this.element.children( "li" )
.removeClass( "ui-menubar-item" )
- .removeAttr( "role", "presentation" )
+ .removeAttr( "role" )
.children( "button, a" );
this.element
.removeClass( "ui-menubar ui-widget-header ui-helper-clearfix" )
- .removeAttr( "role", "menubar" )
+ .removeAttr( "role" )
.unbind( ".menubar" );
items
.unbind( ".menubar" )
.removeClass( "ui-button ui-widget ui-button-text-only ui-menubar-link ui-state-default" )
- .removeAttr( "role", "menuitem" )
- .removeAttr( "aria-haspopup", "true" )
+ .removeAttr( "role" )
+ .removeAttr( "aria-haspopup" )
// TODO unwrap?
.children( "span.ui-button-text" ).each(function( i, e ) {
var item = $( this );
@@ -175,8 +198,8 @@ $.widget( "ui.menubar", {
this.element.find( ":ui-menu" )
.menu( "destroy" )
.show()
- .removeAttr( "aria-hidden", "true" )
- .removeAttr( "aria-expanded", "false" )
+ .removeAttr( "aria-hidden" )
+ .removeAttr( "aria-expanded" )
.removeAttr( "tabindex" )
.unbind( ".menubar" );
},
@@ -185,10 +208,12 @@ $.widget( "ui.menubar", {
if ( !this.active || !this.active.length )
return;
this.active
- .menu( "closeAll" )
+ .menu( "collapseAll" )
.hide()
- .attr( "aria-hidden", "true" )
- .attr( "aria-expanded", "false" );
+ .attr({
+ "aria-hidden": "true",
+ "aria-expanded": "false"
+ });
this.active
.prev()
.removeClass( "ui-state-active" )
@@ -205,10 +230,12 @@ $.widget( "ui.menubar", {
// TODO refactor, almost the same as _close above, but don't remove tabIndex
if ( this.active ) {
this.active
- .menu( "closeAll" )
+ .menu( "collapseAll" )
.hide()
- .attr( "aria-hidden", "true" )
- .attr( "aria-expanded", "false" );
+ .attr({
+ "aria-hidden": "true",
+ "aria-expanded": "false"
+ });
this.active
.prev()
.removeClass( "ui-state-active" );
diff --git a/ui/jquery.ui.popup.js b/ui/jquery.ui.popup.js
index d455346dc..508209a55 100644
--- a/ui/jquery.ui.popup.js
+++ b/ui/jquery.ui.popup.js
@@ -41,7 +41,7 @@ $.widget( "ui.popup", {
}
this.options.trigger
- .attr( "aria-haspopup", true )
+ .attr( "aria-haspopup", "true" )
.attr( "aria-owns", this.element.attr( "id" ) );
this.element
@@ -163,8 +163,8 @@ $.widget( "ui.popup", {
this.element
.show()
- .attr( "aria-hidden", false )
- .attr( "aria-expanded", true )
+ .attr( "aria-hidden", "false" )
+ .attr( "aria-expanded", "true" )
.position( position );
if (this.element.is( ":ui-menu" )) { //popup is a menu
@@ -194,8 +194,8 @@ $.widget( "ui.popup", {
close: function( event ) {
this.element
.hide()
- .attr( "aria-hidden", true )
- .attr( "aria-expanded", false );
+ .attr( "aria-hidden", "true" )
+ .attr( "aria-expanded", "false" );
this.options.trigger.attr( "tabindex" , 0 );
if ( this.removeTabIndex ) {
diff --git a/ui/jquery.ui.position.js b/ui/jquery.ui.position.js
index 3bae0d010..23a98b491 100644
--- a/ui/jquery.ui.position.js
+++ b/ui/jquery.ui.position.js
@@ -204,7 +204,8 @@ $.fn.position = function( options ) {
offset: [ atOffset[ 0 ] + myOffset[ 0 ], atOffset [ 1 ] + myOffset[ 1 ] ],
my: options.my,
at: options.at,
- within: within
+ within: within,
+ elem : elem
});
}
});
@@ -265,6 +266,9 @@ $.ui.position = {
return;
}
+ data.elem
+ .removeClass( "ui-flipped-left ui-flipped-right" );
+
var within = data.within,
win = $( window ),
isWindow = $.isWindow( data.within[0] ),
@@ -283,6 +287,10 @@ $.ui.position = {
-data.targetWidth,
offset = -2 * data.offset[ 0 ];
if ( overLeft < 0 || overRight > 0 ) {
+
+ data.elem
+ .addClass( "ui-flipped-" + ( overLeft < 0 ? "right" : "left" ) );
+
position.left += myOffset + atOffset + offset;
}
},
@@ -290,6 +298,10 @@ $.ui.position = {
if ( data.at[ 1 ] === center ) {
return;
}
+
+ data.elem
+ .removeClass( "ui-flipped-top ui-flipped-bottom" );
+
var within = data.within,
win = $( window ),
isWindow = $.isWindow( data.within[0] ),
@@ -308,6 +320,10 @@ $.ui.position = {
-data.targetHeight,
offset = -2 * data.offset[ 1 ];
if ( overTop < 0 || overBottom > 0 ) {
+
+ data.elem
+ .addClass( "ui-flipped-" + ( overTop < 0 ? "bottom" : "top" ) );
+
position.top += myOffset + atOffset + offset;
}
}
diff --git a/ui/jquery.ui.slider.js b/ui/jquery.ui.slider.js
index 978155370..9c5d21ffb 100644
--- a/ui/jquery.ui.slider.js
+++ b/ui/jquery.ui.slider.js
@@ -502,10 +502,10 @@ $.widget( "ui.slider", $.ui.mouse, {
if ( value ) {
this.handles.filter( ".ui-state-focus" ).blur();
this.handles.removeClass( "ui-state-hover" );
- this.handles.attr( "disabled", "disabled" );
+ this.handles.prop( "disabled", true );
this.element.addClass( "ui-disabled" );
} else {
- this.handles.removeAttr( "disabled" );
+ this.handles.prop( "disabled", false );
this.element.removeClass( "ui-disabled" );
}
break;
diff --git a/ui/jquery.ui.spinner.js b/ui/jquery.ui.spinner.js
index 951b336ed..b03c59709 100644
--- a/ui/jquery.ui.spinner.js
+++ b/ui/jquery.ui.spinner.js
@@ -302,10 +302,10 @@ $.widget( "ui.spinner", {
if ( key === "disabled" ) {
if ( value ) {
- this.element.attr( "disabled", true );
+ this.element.prop( "disabled", true );
this.buttons.button( "disable" );
} else {
- this.element.removeAttr( "disabled" );
+ this.element.prop( "disabled", false );
this.buttons.button( "enable" );
}
}
@@ -343,7 +343,7 @@ $.widget( "ui.spinner", {
destroy: function() {
this.element
.removeClass( "ui-spinner-input" )
- .removeAttr( "disabled" )
+ .prop( "disabled", false )
.removeAttr( "autocomplete" )
.removeAttr( "role" )
.removeAttr( "aria-valuemin" )
diff --git a/ui/jquery.ui.tooltip.js b/ui/jquery.ui.tooltip.js
index f19061bc3..5e32459fc 100644
--- a/ui/jquery.ui.tooltip.js
+++ b/ui/jquery.ui.tooltip.js
@@ -148,7 +148,14 @@ $.widget( "ui.tooltip", {
this._bind( target, {
mouseleave: "close",
- blur: "close"
+ blur: "close",
+ keyup: function( event ) {
+ if ( event.keyCode == $.ui.keyCode.ESCAPE ) {
+ var fakeEvent = $.Event(event);
+ fakeEvent.currentTarget = target[0];
+ this.close( fakeEvent, true );
+ }
+ }
});
},
@@ -176,7 +183,7 @@ $.widget( "ui.tooltip", {
delete that.tooltips[ this.id ];
});
- target.unbind( "mouseleave.tooltip blur.tooltip" );
+ target.unbind( "mouseleave.tooltip blur.tooltip keyup.tooltip" );
this._trigger( "close", event, { tooltip: tooltip } );
},