* @param string element
* @param array showItems
* @param array hideItems
+ * @param function callback
*/
WCF.ToggleOptions = Class.extend({
/**
* @var array
*/
_hideItems: [],
+
+ /**
+ * callback after options were toggled
+ *
+ * @var function
+ */
+ _callback: null,
/**
* Initializes option toggle.
* @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));
$('#' + $item).hide();
}
+
+ if (this._callback !== null) {
+ $.proxy(this._callback, this);
+ }
}
});