diff options
Diffstat (limited to 'lib/scripts/behaviour.js')
-rw-r--r-- | lib/scripts/behaviour.js | 74 |
1 files changed, 37 insertions, 37 deletions
diff --git a/lib/scripts/behaviour.js b/lib/scripts/behaviour.js index cffdde042..6878b0b96 100644 --- a/lib/scripts/behaviour.js +++ b/lib/scripts/behaviour.js @@ -1,4 +1,39 @@ /** + * Hides elements with a slide animation + * + * @param fn optional callback to run after hiding + * @author Adrian Lang <mail@adrianlang.de> + */ +jQuery.fn.dw_hide = function(fn) { + return this.slideUp('fast', fn); +}; + +/** + * Unhides elements with a slide animation + * + * @param fn optional callback to run after hiding + * @author Adrian Lang <mail@adrianlang.de> + */ +jQuery.fn.dw_show = function(fn) { + return this.slideDown('fast', fn); +}; + +/** + * Toggles visibility of an element using a slide element + * + * @param bool the current state of the element (optional) + */ +jQuery.fn.dw_toggle = function(bool, fn) { + return this.each(function() { + var $this = jQuery(this); + if (typeof bool === 'undefined') { + bool = $this.is(':hidden'); + } + $this[bool ? "dw_show" : "dw_hide" ](fn); + }); +}; + +/** * Automatic behaviours * * This class wraps various JavaScript functionalities that are triggered @@ -16,7 +51,7 @@ var dw_behaviour = { dw_behaviour.subscription(); dw_behaviour.revisionBoxHandler(); - jQuery('#page__revisions input[type=checkbox]').live('click', + jQuery('#page__revisions input[type=checkbox]').on('click', dw_behaviour.revisionBoxHandler ); }, @@ -77,7 +112,7 @@ var dw_behaviour = { return; } - jQuery('a.windows').live('click', function(){ + jQuery('a.windows').on('click', function(){ alert(LANG.nosmblinks.replace(/\\n/,"\n")); }); }, @@ -142,39 +177,4 @@ var dw_behaviour = { }; -/** - * Hides elements with a slide animation - * - * @param fn optional callback to run after hiding - * @author Adrian Lang <mail@adrianlang.de> - */ -jQuery.fn.dw_hide = function(fn) { - return this.slideUp('fast', fn); -}; - -/** - * Unhides elements with a slide animation - * - * @param fn optional callback to run after hiding - * @author Adrian Lang <mail@adrianlang.de> - */ -jQuery.fn.dw_show = function(fn) { - return this.slideDown('fast', fn); -}; - -/** - * Toggles visibility of an element using a slide element - * - * @param bool the current state of the element (optional) - */ -jQuery.fn.dw_toggle = function(bool, fn) { - return this.each(function() { - var $this = jQuery(this); - if (typeof bool === 'undefined') { - bool = $this.is(':hidden'); - } - $this[bool ? "dw_show" : "dw_hide" ](fn); - }); -}; - jQuery(dw_behaviour.init); |