Do not close sidebar when collapsing networks

Fixes #2293
This commit is contained in:
Pavel Djundik 2018-03-26 11:46:01 +03:00
parent 2cfd0e1fe0
commit a2440e665f
2 changed files with 7 additions and 5 deletions

View File

@ -335,7 +335,7 @@ $(function() {
$(this).closest(".msg.condensed").toggleClass("closed"); $(this).closest(".msg.condensed").toggleClass("closed");
}); });
const openWindow = function openWindow(e, data) { const openWindow = function openWindow(e, {keepSidebarOpen, pushState, replaceHistory}) {
const self = $(this); const self = $(this);
const target = self.data("target"); const target = self.data("target");
@ -372,7 +372,7 @@ $(function() {
utils.toggleNotificationMarkers(false); utils.toggleNotificationMarkers(false);
} }
if ($(window).outerWidth() < utils.mobileViewportPixels) { if (!keepSidebarOpen && $(window).outerWidth() < utils.mobileViewportPixels) {
slideoutMenu.toggle(false); slideoutMenu.toggle(false);
} }
} }
@ -455,7 +455,7 @@ $(function() {
// contains a CSS selector that targets elements which takes the user to a different view // 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 // when clicked. The `popstate` event listener will trigger synthetic click events using that
// selector and thus take the user to a different view/state. // selector and thus take the user to a different view/state.
if (data && data.pushState === false) { if (pushState === false) {
return false; return false;
} }
@ -470,7 +470,7 @@ $(function() {
} }
if (history && history.pushState) { if (history && history.pushState) {
if (data && data.replaceHistory && history.replaceState) { if (replaceHistory && history.replaceState) {
history.replaceState(state, null, target); history.replaceState(state, null, target);
} else { } else {
history.pushState(state, null, target); history.pushState(state, null, target);

View File

@ -320,7 +320,9 @@ function collapseNetwork(target) {
const networkuuid = collapseButton.closest(".network").data("uuid"); const networkuuid = collapseButton.closest(".network").data("uuid");
if (collapseButton.closest(".network").find(".active").length > 0) { if (collapseButton.closest(".network").find(".active").length > 0) {
collapseButton.closest(".lobby").click(); collapseButton.closest(".lobby").trigger("click", {
keepSidebarOpen: true,
});
} }
collapseButton.closest(".network").toggleClass("collapsed"); collapseButton.closest(".network").toggleClass("collapsed");