From 14c5ff9e7f3732311703b8dc3c5d990d219bed63 Mon Sep 17 00:00:00 2001 From: Daniel Rudolf Date: Tue, 26 Feb 2013 18:58:09 +0100 Subject: [PATCH] Add callback param to WCF.ToggleOptions --- wcfsetup/install/files/js/WCF.js | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) 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); + } } }); -- 2.20.1