From 000d56a96dc229f036375c7dc2d57439cd678ac0 Mon Sep 17 00:00:00 2001 From: Pavel Djundik Date: Tue, 29 May 2018 13:07:18 +0300 Subject: [PATCH] Show connect window when last network is removed --- client/js/render.js | 2 +- client/js/socket-events/quit.js | 11 ++++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/client/js/render.js b/client/js/render.js index 9836faf7..44c512b5 100644 --- a/client/js/render.js +++ b/client/js/render.js @@ -202,7 +202,7 @@ function renderNetworks(data, singleNetwork) { sidebar.find(".networks").append( templates.network({ networks: data.networks, - }) + }).trim() ); collapsed.forEach((key) => { diff --git a/client/js/socket-events/quit.js b/client/js/socket-events/quit.js index 18365448..1b2bba8b 100644 --- a/client/js/socket-events/quit.js +++ b/client/js/socket-events/quit.js @@ -16,11 +16,16 @@ socket.on("quit", function(data) { network.remove(); - const chan = sidebar.find(".chan") - .eq(0) - .trigger("click"); + const chan = sidebar.find(".chan"); if (chan.length === 0) { sidebar.find(".empty").show(); + + // Open the connect window + $("#footer .connect").trigger("click", { + pushState: false, + }); + } else { + chan.eq(0).trigger("click"); } });