From: Daniel Rudolf Date: Tue, 26 Feb 2013 17:58:09 +0000 (+0100) Subject: Add callback param to WCF.ToggleOptions X-Git-Tag: 2.0.0_Beta_1~456^2~2 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=14c5ff9e7f3732311703b8dc3c5d990d219bed63;p=GitHub%2FWoltLab%2FWCF.git Add callback param to WCF.ToggleOptions --- diff --git a/wcfsetup/install/files/js/WCF.js b/wcfsetup/install/files/js/WCF.js index 01c3667e6d..1e172b1f0f 100755 --- a/wcfsetup/install/files/js/WCF.js +++ b/wcfsetup/install/files/js/WCF.js @@ -3331,6 +3331,7 @@ WCF.Template.Compiled = Class.extend({ * @param string element * @param array showItems * @param array hideItems + * @param function callback */ WCF.ToggleOptions = Class.extend({ /** @@ -3353,6 +3354,13 @@ WCF.ToggleOptions = Class.extend({ * @var array */ _hideItems: [], + + /** + * callback after options were toggled + * + * @var function + */ + _callback: null, /** * Initializes option toggle. @@ -3360,11 +3368,15 @@ WCF.ToggleOptions = Class.extend({ * @param string element * @param array showItems * @param array hideItems + * @param function callback */ - init: function(element, showItems, hideItems) { + init: function(element, showItems, hideItems, callback) { this._element = $('#' + element); this._showItems = showItems; this._hideItems = hideItems; + if (callback !== undefined) { + this._callback = callback; + } // bind event this._element.click($.proxy(this._toggle, this)); @@ -3390,6 +3402,10 @@ WCF.ToggleOptions = Class.extend({ $('#' + $item).hide(); } + + if (this._callback !== null) { + $.proxy(this._callback, this); + } } });