aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorScott González <scott.gonzalez@gmail.com>2009-06-11 21:21:35 +0000
committerScott González <scott.gonzalez@gmail.com>2009-06-11 21:21:35 +0000
commit83eafe63d9cfd02f8b47af996b3838de6b1aa607 (patch)
tree4c522702dc4dd457bde466ef4f0a7a4f3e4a13df
parent4175ca180af57cb3c5cd938fb828b2d11404ae43 (diff)
downloadjquery-ui-83eafe63d9cfd02f8b47af996b3838de6b1aa607.tar.gz
jquery-ui-83eafe63d9cfd02f8b47af996b3838de6b1aa607.zip
Effects core: Reorganized method overloading.
-rw-r--r--ui/effects.core.js21
1 files changed, 10 insertions, 11 deletions
diff --git a/ui/effects.core.js b/ui/effects.core.js
index a5d8dcb31..e1b7b2515 100644
--- a/ui/effects.core.js
+++ b/ui/effects.core.js
@@ -155,18 +155,7 @@ function _normalizeArguments(effect, options, speed, callback) {
return [effect, options, speed, callback];
}
-//Extend the methods of jQuery
$.fn.extend({
-
- //Save old methods
- _show: $.fn.show,
- _hide: $.fn.hide,
- __toggle: $.fn.toggle,
- _addClass: $.fn.addClass,
- _removeClass: $.fn.removeClass,
- _toggleClass: $.fn.toggleClass,
-
- // New effect methods
effect: function(effect, options, speed, callback) {
var args = _normalizeArguments.apply(this, arguments),
// TODO: make effects takes actual parameters instead of a hash
@@ -180,6 +169,7 @@ $.fn.extend({
return effectMethod && !$.fx.off ? effectMethod.call(this, args2) : this;
},
+ _show: $.fn.show,
show: function(speed) {
if (!speed || typeof speed == 'number' || $.fx.speeds[speed]) {
return this._show.apply(this, arguments);
@@ -190,6 +180,7 @@ $.fn.extend({
}
},
+ _hide: $.fn.hide,
hide: function(speed) {
if (!speed || typeof speed == 'number' || $.fx.speeds[speed]) {
return this._hide.apply(this, arguments);
@@ -200,6 +191,8 @@ $.fn.extend({
}
},
+ // jQuery core overloads toggle and create _toggle
+ __toggle: $.fn.toggle,
toggle: function(speed) {
if (!speed || typeof speed == 'number' || $.fx.speeds[speed] ||
typeof speed == 'boolean' || $.isFunction(speed)) {
@@ -211,15 +204,21 @@ $.fn.extend({
}
},
+ _addClass: $.fn.addClass,
addClass: function(classNames, speed, easing, callback) {
return speed ? $.effects.animateClass.apply(this, [{ add: classNames },speed,easing,callback]) : this._addClass(classNames);
},
+
+ _removeClass: $.fn.removeClass,
removeClass: function(classNames,speed,easing,callback) {
return speed ? $.effects.animateClass.apply(this, [{ remove: classNames },speed,easing,callback]) : this._removeClass(classNames);
},
+
+ _toggleClass: $.fn.toggleClass,
toggleClass: function(classNames,speed,easing,callback) {
return ( (typeof speed !== "boolean") && speed ) ? $.effects.animateClass.apply(this, [{ toggle: classNames },speed,easing,callback]) : this._toggleClass(classNames, speed);
},
+
morph: function(remove,add,speed,easing,callback) {
return $.effects.animateClass.apply(this, [{ add: add, remove: remove },speed,easing,callback]);
},