diff options
Diffstat (limited to 'lib/scripts/behaviour.js')
-rw-r--r-- | lib/scripts/behaviour.js | 32 |
1 files changed, 18 insertions, 14 deletions
diff --git a/lib/scripts/behaviour.js b/lib/scripts/behaviour.js index fb61f6e48..b05949a90 100644 --- a/lib/scripts/behaviour.js +++ b/lib/scripts/behaviour.js @@ -1,37 +1,41 @@ /** * Hides elements with a slide animation * - * @param fn optional callback to run after hiding + * @param {function} fn optional callback to run after hiding + * @param {bool} noaria supress aria-expanded state setting * @author Adrian Lang <mail@adrianlang.de> */ -jQuery.fn.dw_hide = function(fn) { - this.attr('aria-expanded', 'false'); +jQuery.fn.dw_hide = function(fn, noaria) { + if(!noaria) this.attr('aria-expanded', 'false'); return this.slideUp('fast', fn); }; /** * Unhides elements with a slide animation * - * @param fn optional callback to run after hiding + * @param {function} fn optional callback to run after hiding + * @param {bool} noaria supress aria-expanded state setting * @author Adrian Lang <mail@adrianlang.de> */ -jQuery.fn.dw_show = function(fn) { - this.attr('aria-expanded', 'true'); +jQuery.fn.dw_show = function(fn, noaria) { + if(!noaria) this.attr('aria-expanded', 'true'); return this.slideDown('fast', fn); }; /** * Toggles visibility of an element using a slide element * - * @param bool the current state of the element (optional) + * @param {bool} state the current state of the element (optional) + * @param {function} fn callback after the state has been toggled + * @param {bool} noaria supress aria-expanded state setting */ -jQuery.fn.dw_toggle = function(bool, fn) { +jQuery.fn.dw_toggle = function(state, fn, noaria) { return this.each(function() { var $this = jQuery(this); - if (typeof bool === 'undefined') { - bool = $this.is(':hidden'); + if (typeof state === 'undefined') { + state = $this.is(':hidden'); } - $this[bool ? "dw_show" : "dw_hide" ](fn); + $this[state ? "dw_show" : "dw_hide" ](fn, noaria); }); }; @@ -107,7 +111,7 @@ var dw_behaviour = { quickSelect: function(){ jQuery('select.quickselect') .change(function(e){ e.target.form.submit(); }) - .closest('form').find('input[type=submit]').not('.show').hide(); + .closest('form').find(':button').not('.show').hide(); }, /** @@ -171,10 +175,10 @@ var dw_behaviour = { if($checked.length < 2){ $all.attr('disabled',false); - jQuery('#page__revisions input[type=submit]').attr('disabled',true); + jQuery('#page__revisions button').attr('disabled',true); }else{ $all.attr('disabled',true); - jQuery('#page__revisions input[type=submit]').attr('disabled',false); + jQuery('#page__revisions button').attr('disabled',false); for(var i=0; i<$checked.length; i++){ $checked[i].disabled = false; if(i>1){ |