From: Alexander Ebert Date: Sat, 10 Dec 2016 22:28:20 +0000 (+0100) Subject: Added event before tab change X-Git-Tag: 3.0.0_RC_1~47 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=dc756c0bd8172687bfc595a40fd807df83100dde;p=GitHub%2FWoltLab%2FWCF.git Added event before tab change --- diff --git a/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/TabMenu/Simple.js b/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/TabMenu/Simple.js index ae9d26c2cf..5fc784fd23 100644 --- a/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/TabMenu/Simple.js +++ b/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/TabMenu/Simple.js @@ -215,11 +215,19 @@ define(['Dictionary', 'EventHandler', 'Dom/Traverse', 'Dom/Util'], function(Dict var oldTab = this.getActiveTab(); var oldContent = null; if (oldTab) { - if (elData(oldTab, 'name') === name) { + var oldTabName = elData(oldTab, 'name'); + if (oldTabName === name) { // same tab return; } + if (!disableEvent) { + EventHandler.fire('com.woltlab.wcf.simpleTabMenu_' + this._container.id, 'beforeSelect', { + tab: oldTab, + tabName: oldTabName + }); + } + oldTab.classList.remove('active'); oldContent = this._containers.get(elData(oldTab, 'name')); oldContent.classList.remove('active');