aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--AUTHORS.txt1
-rw-r--r--README.md12
-rw-r--r--demos/menubar/default.html15
-rw-r--r--demos/position/default.html18
-rw-r--r--tests/unit/datepicker/datepicker_events.js5
-rw-r--r--tests/unit/datepicker/datepicker_options.js10
-rw-r--r--tests/unit/datepicker/datepicker_tickets.js14
-rw-r--r--tests/unit/effects/effects_core.js27
-rw-r--r--tests/unit/menu/menu_events.js21
-rw-r--r--tests/unit/position/position_core.js81
-rw-r--r--tests/unit/position/position_core_within.js95
-rw-r--r--tests/visual/datepicker/datepicker_ticket_7552.html23
-rw-r--r--tests/visual/position/position_within.html13
-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.js12
-rw-r--r--ui/jquery.ui.datepicker.js27
-rw-r--r--ui/jquery.ui.dialog.js5
-rw-r--r--ui/jquery.ui.menu.js41
-rw-r--r--ui/jquery.ui.menubar.js31
-rw-r--r--ui/jquery.ui.position.js18
-rw-r--r--ui/jquery.ui.tooltip.js11
36 files changed, 1226 insertions, 864 deletions
diff --git a/.gitignore b/.gitignore
index e39040f5b..e5d3578f1 100644
--- a/.gitignore
+++ b/.gitignore
@@ -5,3 +5,4 @@ docs
*.diff
*.patch
.DS_Store
+.settings
diff --git a/AUTHORS.txt b/AUTHORS.txt
index b2168655e..ecb4eb460 100644
--- a/AUTHORS.txt
+++ b/AUTHORS.txt
@@ -17,6 +17,7 @@ Bohdan Ganicky
Scott González
Marc Grabanski (m@marcgrabanski.com)
Klaus Hartl (stilbuero.de)
+Hans Hillen (TPG, funded through AEGIS: http://www.aegis-project.eu/)
Scott Jehl
Cody Lindley
Eduardo Lundgren (eduardolundgren@gmail.com)
diff --git a/README.md b/README.md
index 547f2886b..a233d9457 100644
--- a/README.md
+++ b/README.md
@@ -8,6 +8,18 @@ If you want to use jQuery UI, go to [jqueryui.com](http://jqueryui.com) to get s
If you are interested in helping developing jQuery UI, you are in the right place.
To discuss development with team members and the community, visit the [Developing jQuery UI Forum](http://forum.jquery.com/developing-jquery-ui).
+For contributors
+---
+If you want to help and provide a patch for a bugfix or new feature, please take
+a few minutes and look at [our Getting Involved guide](http://wiki.jqueryui.com/w/page/35263114/Getting-Involved),
+in particular check out the [Coding standards](http://wiki.jqueryui.com/w/page/12137737/Coding-standards)
+and [Commit Message Style Guide](http://wiki.jqueryui.com/w/page/25941597/Commit-Message-Style-Guide).
+
+In general, fork the project, create a branch for a specific change and send a
+pull request for that branch. Don't mix unrelated changes. You can use the commit
+message as the description for the pull request.
+
+
For committers
---
When looking at pull requests, first check for [proper commit messages](http://wiki.jqueryui.com/w/page/12137724/Bug-Fixing-Guide).
diff --git a/demos/menubar/default.html b/demos/menubar/default.html
index 57a3209ce..adee4afc9 100644
--- a/demos/menubar/default.html
+++ b/demos/menubar/default.html
@@ -13,24 +13,27 @@
<script src="../../ui/jquery.ui.menubar.js"></script>
<script>
$(function() {
+ function select(event, ui) {
+ $("<div/>").text("Selected: " + ui.item.text()).appendTo("#log");
+ if (ui.item.text() == 'Quit') {
+ $(this).menubar('destroy');
+ }
+ }
$("#bar1").menubar({
position: {
within: $("#demo-frame").add(window).first()
},
- select: function(event, ui) {
- $("<div/>").text("Selected: " + ui.item.text()).appendTo("#log");
- }
+ select: select
});
$(".menubar-icons").menubar({
+ autoExpand: true,
menuIcon: true,
buttons: true,
position: {
within: $("#demo-frame").add(window).first()
},
- select: function(event, ui) {
- $("<div/>").text("Selected: " + ui.item.text()).appendTo("#log");
- }
+ select: select
});
});
</script>
diff --git a/demos/position/default.html b/demos/position/default.html
index 87fc8e38a..72bf8abcc 100644
--- a/demos/position/default.html
+++ b/demos/position/default.html
@@ -12,7 +12,7 @@
<script src="../../ui/jquery.ui.position.js"></script>
<link rel="stylesheet" href="../demos.css">
<style>
- div#parent {
+ #parent {
width: 60%;
margin: 10px auto;
padding: 5px;
@@ -20,7 +20,7 @@
background-color: #fbca93;
text-align: center;
}
- div.positionable {
+ .positionable {
width: 75px;
height: 75px;
position: absolute;
@@ -30,6 +30,18 @@
background-color: #bcd5e6;
text-align: center;
}
+ .ui-flipped-top {
+ border-top: 3px solid #000000;
+ }
+ .ui-flipped-bottom {
+ border-bottom: 3px solid #000000;
+ }
+ .ui-flipped-left {
+ border-left: 3px solid #000000;
+ }
+ .ui-flipped-right {
+ border-right: 3px solid #000000;
+ }
select, input {
margin-left: 15px;
}
@@ -101,7 +113,7 @@
<option value="left">left</option>
<option value="center">center</option>
<option value="right">right</option>
- </select>
+ </select>
<select id="my_vertical">
<option value="top">top</option>
<option value="middle">center</option>
diff --git a/tests/unit/datepicker/datepicker_events.js b/tests/unit/datepicker/datepicker_events.js
index bf48c9c8a..c7c16b610 100644
--- a/tests/unit/datepicker/datepicker_events.js
+++ b/tests/unit/datepicker/datepicker_events.js
@@ -41,6 +41,11 @@ test('events', function() {
simulate('keydown', {keyCode: $.simulate.VK_ESC});
equals(selectedDate, $.datepicker.formatDate('mm/dd/yy', date),
'Callback selected date - esc');
+ var dateStr = '02/04/2008';
+ inp.val(dateStr).datepicker('show').
+ simulate('keydown', {keyCode: $.simulate.VK_ENTER});
+ equals(dateStr, selectedDate,
+ 'onSelect is called after enter keydown');
// onChangeMonthYear
inp.datepicker('option', {onChangeMonthYear: callback2, onSelect: null}).
val('').datepicker('show');
diff --git a/tests/unit/datepicker/datepicker_options.js b/tests/unit/datepicker/datepicker_options.js
index a10d1ea45..107609174 100644
--- a/tests/unit/datepicker/datepicker_options.js
+++ b/tests/unit/datepicker/datepicker_options.js
@@ -469,6 +469,16 @@ test('setDate', function() {
var dateAndTimeClone = new Date(2008, 3 - 1, 28, 1, 11, 0);
inp.datepicker('setDate', dateAndTimeToSet);
equals(dateAndTimeToSet.getTime(), dateAndTimeClone.getTime(), 'Date object passed should not be changed by setDate');
+ // Test onSelect callback is executed when using setDate
+ inp.datepicker('destroy');
+ var testDate = null;
+ inp.datepicker({
+ onSelect: function(dateText, inst) {
+ testDate = new Date(dateText);
+ }
+ });
+ inp.datepicker('setDate', date2);
+ equals(date2.getTime(), testDate.getTime(), 'onSelect is called after setDate');
});
test('altField', function() {
diff --git a/tests/unit/datepicker/datepicker_tickets.js b/tests/unit/datepicker/datepicker_tickets.js
index d5249f905..10647eb13 100644
--- a/tests/unit/datepicker/datepicker_tickets.js
+++ b/tests/unit/datepicker/datepicker_tickets.js
@@ -30,12 +30,22 @@ test('Ticket 6827: formatDate day of year calculation is wrong during day lights
});
test('Ticket #7244: date parser does not fail when too many numbers are passed into the date function', function() {
- expect(1);
+ var date;
try{
- var date = $.datepicker.parseDate('dd/mm/yy', '18/04/19881');
+ date = $.datepicker.parseDate('dd/mm/yy', '18/04/19881');
+ ok(false, "Did not properly detect an invalid date");
}catch(e){
ok("invalid date detected");
}
+
+ try {
+ date = $.datepicker.parseDate('dd/mm/yy', '18/04/1988 @ 2:43 pm');
+ equal(date.getDate(), 18);
+ equal(date.getMonth(), 3);
+ equal(date.getFullYear(), 1988);
+ } catch(e) {
+ ok(false, "Did not properly parse date with extra text separated by whitespace");
+ }
});
})(jQuery);
diff --git a/tests/unit/effects/effects_core.js b/tests/unit/effects/effects_core.js
index 4c685ebb6..7c20e22fe 100644
--- a/tests/unit/effects/effects_core.js
+++ b/tests/unit/effects/effects_core.js
@@ -19,6 +19,18 @@ var minDuration = 15,
module( "effects.core" );
+test( "Immediate Return Conditions", function() {
+ var hidden = $( "div.hidden" ),
+ count = 0;
+ expect( 3 );
+ hidden.hide( "blind", function() {
+ equal( ++count, 1, "Hide on hidden returned immediately" );
+ }).show().show( "blind", function() {
+ equal( ++count, 2, "Show on shown returned immediately" );
+ });
+ equal( ++count, 3, "Both Functions worked properly" );
+});
+
$.each( $.effects.effect, function( effect ) {
if ( effect === "transfer" ) {
return;
@@ -123,4 +135,19 @@ asyncTest( "animateClass works with children", function() {
}});
});
+asyncTest( "animateClass clears style properties when stopped", function() {
+ var test = $("div.animateClass"),
+ style = test[0].style,
+ orig = style.cssText;
+
+ expect( 2 );
+
+ test.addClass( "testChangeBackground", duration );
+ notEqual( orig, style.cssText, "cssText is the not the same after starting animation" );
+
+ test.stop( true, true );
+ equal( orig, style.cssText, "cssText is the same after stopping animation midway" );
+ start();
+});
+
})(jQuery);
diff --git a/tests/unit/menu/menu_events.js b/tests/unit/menu/menu_events.js
index a03bec3f6..2f713acf8 100644
--- a/tests/unit/menu/menu_events.js
+++ b/tests/unit/menu/menu_events.js
@@ -21,4 +21,25 @@ test("handle click on menu", function() {
equals( $("#log").html(), "1,3,2,afterclick,1,click,", "Click order not valid.");
});
+test( "handle blur: click", function() {
+ expect( 4 );
+ var $menu = $( "#menu1" ).menu({
+ focus: function( event, ui ) {
+ equal( event.originalEvent.type, "click", "focus triggered 'click'" );
+ equal( event.type, "menufocus", "focus event.type is 'menufocus'" );
+
+ },
+ blur: function( event, ui ) {
+ console.log( event, ui );
+ equal( event.originalEvent.type, "click", "blur triggered 'click'" );
+ equal( event.type, "menublur", "blur event.type is 'menublur'" );
+ }
+ });
+
+ $menu.find( "li a:first" ).trigger( "click" );
+ $( "<a/>", { id: "remove"} ).appendTo("body").trigger( "click" );
+
+ $("#remove").remove();
+});
+
})(jQuery);
diff --git a/tests/unit/position/position_core.js b/tests/unit/position/position_core.js
index bd8e58612..fd6e643e9 100644
--- a/tests/unit/position/position_core.js
+++ b/tests/unit/position/position_core.js
@@ -435,6 +435,87 @@ test( "collision: flip, with margin", function() {
}, { top: 0, left: 0 }, "right bottom" );
});
+test( "addClass: flipped left", function() {
+ var elem = $( "#elx" ).position( {
+ my: "left center",
+ of: window,
+ collision: "flip",
+ at: "right center"
+ });
+
+ same( elem.hasClass( 'ui-flipped-left' ), true, 'Has ui-flipped-left class' );
+
+ elem.position( {
+ my: "right center",
+ of: window,
+ collision: "flip",
+ at: "left center"
+ })
+
+ same( elem.hasClass( 'ui-flipped-left' ), false, 'Removed ui-flipped-left class' );
+});
+
+test( "addClass: flipped top", function() {
+ var elem = $( "#elx" ).position( {
+ my: "left top",
+ of: window,
+ collision: "flip",
+ at: "right bottom"
+ });
+
+ same( elem.hasClass( 'ui-flipped-top' ), true, 'Has ui-flipped-top class' );
+
+ elem.position( {
+ my: "left bottom",
+ of: window,
+ collision: "flip",
+ at: "right top"
+ });
+
+ same( elem.hasClass( 'ui-flipped-top' ), false, 'Removed ui-flipped-top class' );
+});
+
+test( "addClass: flipped right", function() {
+ var elem = $( "#elx" ).position( {
+ my: "right center",
+ of: window,
+ collision: "flip",
+ at: "left center"
+ });
+
+ same( elem.hasClass( 'ui-flipped-right' ), true, 'Has ui-flipped-right class' );
+
+ elem.position( {
+ my: "left center",
+ of: window,
+ collision: "flip",
+ at: "right center"
+ });
+
+ same( elem.hasClass( 'ui-flipped-right' ), false, 'Removed ui-flipped-right class' );
+
+});
+
+test( "addClass: flipped bottom", function() {
+ var elem = $( "#elx" ).position( {
+ my: "left bottom",
+ of: window,
+ collision: "flip",
+ at: "right top"
+ });
+
+ same( elem.hasClass( 'ui-flipped-bottom' ), true, 'Has ui-flipped-bottom class' );
+
+ elem.position( {
+ my: "left top",
+ of: window,
+ collision: "flip",
+ at: "right bottom"
+ });
+
+ same( elem.hasClass( 'ui-flipped-bottom' ), false, 'Removed ui-flipped-bottom class' );
+});
+
//test( "bug #5280: consistent results (avoid fractional values)", function() {
// var wrapper = $( "#bug-5280" ),
// elem = wrapper.children(),
diff --git a/tests/unit/position/position_core_within.js b/tests/unit/position/position_core_within.js
index 567c17192..bfb913335 100644
--- a/tests/unit/position/position_core_within.js
+++ b/tests/unit/position/position_core_within.js
@@ -438,4 +438,99 @@ test( "collision: flip, with margin", function() {
}, { top: addTop + 0, left: addLeft + 0 }, "right bottom" );
});
+test( "addClass: flipped left", function() {
+ var within = $("#within-container");
+
+ var elem = $( "#elx" ).position( {
+ my: "left center",
+ of: within[0],
+ within: within,
+ collision: "flip",
+ at: "right center"
+ });
+
+ same( elem.hasClass( 'ui-flipped-left' ), true, 'Has ui-flipped-left class' );
+
+ elem.position( {
+ my: "right center",
+ of: within[0],
+ within: within,
+ collision: "flip",
+ at: "left center"
+ })
+
+ same( elem.hasClass( 'ui-flipped-left' ), false, 'Removed ui-flipped-left class' );
+});
+
+test( "addClass: flipped top", function() {
+ var within = $("#within-container");
+
+ var elem = $( "#elx" ).position( {
+ my: "left top",
+ of: within[0],
+ within: within,
+ collision: "flip",
+ at: "right bottom"
+ });
+
+ same( elem.hasClass( 'ui-flipped-top' ), true, 'Has ui-flipped-top class' );
+
+ elem.position( {
+ my: "left bottom",
+ of: within[0],
+ within: within,
+ collision: "flip",
+ at: "right top"
+ });
+
+ same( elem.hasClass( 'ui-flipped-top' ), false, 'Removed ui-flipped-top class' );
+});
+
+test( "addClass: flipped right", function() {
+ var within = $("#within-container");
+
+ var elem = $( "#elx" ).position( {
+ my: "right center",
+ of: within[0],
+ within: within,
+ collision: "flip",
+ at: "left center"
+ });
+
+ same( elem.hasClass( 'ui-flipped-right' ), true, 'Has ui-flipped-right class' );
+
+ elem.position( {
+ my: "left center",
+ of: within[0],
+ within: within,
+ collision: "flip",
+ at: "right center"
+ });
+
+ same( elem.hasClass( 'ui-flipped-right' ), false, 'Removed ui-flipped-right class' );
+
+});
+
+test( "addClass: flipped bottom", function() {
+ var within = $("#within-container");
+
+ var elem = $( "#elx" ).position( {
+ my: "left bottom",
+ of: window,
+ collision: "flip",
+ at: "right top"
+ });
+
+ same( elem.hasClass( 'ui-flipped-bottom' ), true, 'Has ui-flipped-bottom class' );
+
+ elem.position( {
+ my: "left top",
+ of: window,
+ collision: "flip",
+ at: "right bottom"
+ });
+
+ same( elem.hasClass( 'ui-flipped-bottom' ), false, 'Removed ui-flipped-bottom class' );
+});
+
}( jQuery ) );
diff --git a/tests/visual/datepicker/datepicker_ticket_7552.html b/tests/visual/datepicker/datepicker_ticket_7552.html
new file mode 100644
index 000000000..a78a84818
--- /dev/null
+++ b/tests/visual/datepicker/datepicker_ticket_7552.html
@@ -0,0 +1,23 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta charset="UTF-8" />
+ <title>Datepicker Visual Test : Datepicker ticket #7552</title>
+ <link rel="stylesheet" href="../visual.css" type="text/css" />
+ <link rel="stylesheet" href="../../../themes/base/jquery.ui.all.css" type="text/css">
+ <script type="text/javascript" src="../../../jquery-1.5.1.js"></script>
+ <script type="text/javascript" src="../../../ui/jquery.ui.core.js"></script>
+ <script type="text/javascript" src="../../../ui/jquery.ui.widget.js"></script>
+ <script type="text/javascript" src="../../../ui/jquery.ui.datepicker.js"></script>
+ <script type="text/javascript">
+ $(function() {
+ $('<div></div>').datepicker().appendTo("body");
+ });
+ </script>
+</head>
+<body>
+
+<h1 class="ui-widget-header"><a href="http://dev.jqueryui.com/ticket/7552">#7552 - A Datepicker created on a detached div has zero height</a></h1>
+
+</body>
+</html>
diff --git a/tests/visual/position/position_within.html b/tests/visual/position/position_within.html
index f120a4b47..4440a0975 100644
--- a/tests/visual/position/position_within.html
+++ b/tests/visual/position/position_within.html
@@ -66,9 +66,20 @@
bottom: 0;
background-color: #bcd5e6;
text-align: center;
- border:solid 2px #555;
cursor:move;
}
+ .ui-flipped-top {
+ border-top: 3px solid #000000;
+ }
+ .ui-flipped-bottom {
+ border-bottom: 3px solid #000000;
+ }
+ .ui-flipped-left {
+ border-left: 3px solid #000000;
+ }
+ .ui-flipped-right {
+ border-right: 3px solid #000000;
+ }
select, input {
margin-left: 15px;
}
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 97dad0b8b..4a3f29a61 100644
--- a/ui/jquery.ui.accordion.js
+++ b/ui/jquery.ui.accordion.js
@@ -162,6 +162,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 +176,6 @@ $.widget( "ui.accordion", {
this._activate( 0 );
}
- if ( key === "event" ) {
- this._setupEvents( value );
- }
-
if ( key === "icons" ) {
this._destroyIcons();
if ( value ) {
@@ -294,7 +297,6 @@ $.widget( "ui.accordion", {
},
_setupEvents: function( event ) {
- this.headers.unbind( ".accordion" );
if ( event ) {
this.headers.bind( event.split( " " ).join( ".accordion " ) + ".accordion",
$.proxy( this, "_eventHandler" ) );
diff --git a/ui/jquery.ui.datepicker.js b/ui/jquery.ui.datepicker.js
index ee0a86338..87f9bd950 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.
@@ -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..e9cf67540 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();
}
diff --git a/ui/jquery.ui.menu.js b/ui/jquery.ui.menu.js
index 7dd1a9ce0..4717946f1 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 );
}
})
@@ -98,20 +100,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 +124,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 +172,14 @@ $.widget( "ui.menu", {
}
}
});
+
+ this._bind( document, {
+ click: function( event ) {
+ if ( !$( event.target ).closest( ".ui-menu" ).length ) {
+ this.collapseAll( event );
+ }
+ }
+ });
},
_destroy: function() {
@@ -239,7 +249,7 @@ $.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,
@@ -287,10 +297,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 +338,7 @@ $.widget( "ui.menu", {
.position( position );
},
- closeAll: function() {
+ collapseAll: function( event ) {
this.element
.find( "ul" )
.hide()
@@ -329,7 +348,7 @@ $.widget( "ui.menu", {
.find( "a.ui-state-active" )
.removeClass( "ui-state-active" );
- this.blur();
+ this.blur( event );
this.activeMenu = this.element;
},
@@ -344,7 +363,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 +375,7 @@ $.widget( "ui.menu", {
}
},
- right: function( event ) {
+ expand: function( event ) {
var self = this,
newItem = this.active && this.active.children("ul").children("li").first();
@@ -449,11 +468,11 @@ $.widget( "ui.menu", {
},
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..fd6d92d6b 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,10 +49,10 @@ $.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()
@@ -89,7 +90,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 +121,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 +151,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 );
@@ -185,7 +206,7 @@ $.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" );
@@ -205,7 +226,7 @@ $.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" );
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.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 } );
},