Merge pull request #2298 from thelounge/xpaw/fix-2293

Do not close sidebar when collapsing networks
This commit is contained in:
Al McKinlay 2018-03-27 17:29:15 +01:00 committed by GitHub
commit a0523b3427
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
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");