diff options
author | Guy Brand <gb@unistra.fr> | 2013-03-06 14:08:08 +0100 |
---|---|---|
committer | Guy Brand <gb@unistra.fr> | 2013-03-06 14:08:08 +0100 |
commit | 23678e344b4ddcad14254c106ecb93af174fdaa0 (patch) | |
tree | a5c787e4d87313a7fb6f18cb4c78bf210d92d60c /lib/scripts/behaviour.js | |
parent | 847cef0a6bfd2ff9dc54e1fc140f5ba0ece0017a (diff) | |
parent | 5721a1547938df76003c6d91ea003dc1c70abd94 (diff) | |
download | rpg-23678e344b4ddcad14254c106ecb93af174fdaa0.tar.gz rpg-23678e344b4ddcad14254c106ecb93af174fdaa0.tar.bz2 |
Merge branch 'master' into stable
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..f1c46bf4c 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(document).on('click','#page__revisions input[type=checkbox]', 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); |