Fixed context switch for recent activities
authorAlexander Ebert <ebert@woltlab.com>
Thu, 22 Dec 2016 15:54:38 +0000 (16:54 +0100)
committerAlexander Ebert <ebert@woltlab.com>
Thu, 22 Dec 2016 15:54:44 +0000 (16:54 +0100)
wcfsetup/install/files/js/WoltLabSuite/Core/Ui/User/Activity/Recent.js

index 2bda92c98cfc6c11e32b07fd9dabc1baff5ed40f..6a2684c0a6da1fab86e1c8dec2e3571527632f0d 100644 (file)
@@ -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,
                                {