From a2440e665f06629cc8fb4f67d7acd7cbd5580f6a Mon Sep 17 00:00:00 2001 From: Pavel Djundik Date: Mon, 26 Mar 2018 11:46:01 +0300 Subject: [PATCH] Do not close sidebar when collapsing networks Fixes #2293 --- client/js/lounge.js | 8 ++++---- client/js/render.js | 4 +++- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/client/js/lounge.js b/client/js/lounge.js index 0f4b94ae..a8540a8d 100644 --- a/client/js/lounge.js +++ b/client/js/lounge.js @@ -335,7 +335,7 @@ $(function() { $(this).closest(".msg.condensed").toggleClass("closed"); }); - const openWindow = function openWindow(e, data) { + const openWindow = function openWindow(e, {keepSidebarOpen, pushState, replaceHistory}) { const self = $(this); const target = self.data("target"); @@ -372,7 +372,7 @@ $(function() { utils.toggleNotificationMarkers(false); } - if ($(window).outerWidth() < utils.mobileViewportPixels) { + if (!keepSidebarOpen && $(window).outerWidth() < utils.mobileViewportPixels) { slideoutMenu.toggle(false); } } @@ -455,7 +455,7 @@ $(function() { // contains a CSS selector that targets elements which takes the user to a different view // when clicked. The `popstate` event listener will trigger synthetic click events using that // selector and thus take the user to a different view/state. - if (data && data.pushState === false) { + if (pushState === false) { return false; } @@ -470,7 +470,7 @@ $(function() { } if (history && history.pushState) { - if (data && data.replaceHistory && history.replaceState) { + if (replaceHistory && history.replaceState) { history.replaceState(state, null, target); } else { history.pushState(state, null, target); diff --git a/client/js/render.js b/client/js/render.js index 9742fe61..4bbfb548 100644 --- a/client/js/render.js +++ b/client/js/render.js @@ -320,7 +320,9 @@ function collapseNetwork(target) { const networkuuid = collapseButton.closest(".network").data("uuid"); if (collapseButton.closest(".network").find(".active").length > 0) { - collapseButton.closest(".lobby").click(); + collapseButton.closest(".lobby").trigger("click", { + keepSidebarOpen: true, + }); } collapseButton.closest(".network").toggleClass("collapsed");