From 0157a422179c2f34dee37936447b716b75b73e9c Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Thu, 22 Dec 2016 16:54:38 +0100 Subject: [PATCH] Fixed context switch for recent activities --- .../Core/Ui/User/Activity/Recent.js | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/User/Activity/Recent.js b/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/User/Activity/Recent.js index 2bda92c98c..6a2684c0a6 100644 --- a/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/User/Activity/Recent.js +++ b/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/User/Activity/Recent.js @@ -21,10 +21,15 @@ define(['Ajax', 'Language', 'Dom/Util'], function(Ajax, Language, DomUtil) { this._list.appendChild(showMoreItem); this._showMoreItem = showMoreItem; - var button = elBySel('.jsRecentActivitySwitchContext button:not(.active)', container); - if (button !== null) { - button.addEventListener(WCF_CLICK_EVENT, this._switchContext.bind(this)); - } + elBySelAll('.jsRecentActivitySwitchContext .button', container, (function (button) { + button.addEventListener(WCF_CLICK_EVENT, (function (event) { + event.preventDefault(); + + if (!button.classList.contains('active')) { + this._switchContext(); + } + }).bind(this)); + }).bind(this)); }, _showMore: function (event) { @@ -44,9 +49,7 @@ define(['Ajax', 'Language', 'Dom/Util'], function(Ajax, Language, DomUtil) { }); }, - _switchContext: function(event) { - event.preventDefault(); - + _switchContext: function() { Ajax.api( this, { -- 2.20.1