From daa45c13fd6ec37b17127cac485d6cb367171921 Mon Sep 17 00:00:00 2001 From: Cldfire Date: Thu, 14 Dec 2017 22:27:09 -0500 Subject: [PATCH] Remove lobby close button Without cheating and doing `display: none` this time around. --- client/js/lounge.js | 10 +++++++--- client/views/chan.tpl | 2 +- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/client/js/lounge.js b/client/js/lounge.js index 14dafae0..898d20e9 100644 --- a/client/js/lounge.js +++ b/client/js/lounge.js @@ -444,9 +444,9 @@ $(function() { } }); - sidebar.on("click", ".close", function() { + function closeChan(chan) { var cmd = "/close"; - var chan = $(this).closest(".chan"); + if (chan.hasClass("lobby")) { cmd = "/quit"; var server = chan.find(".name").html(); @@ -463,11 +463,15 @@ $(function() { opacity: 0.4, }); return false; + } + + sidebar.on("click", ".close", function() { + closeChan($(this).closest(".chan")); }); const contextMenuActions = { close: function(itemData) { - $(`.networks .chan[data-target="${itemData}"] .close`).click(); + closeChan($(`.networks .chan[data-target="${itemData}"]`)); }, focusChan: function(itemData) { $(`.networks .chan[data-target="${itemData}"]`).click(); diff --git a/client/views/chan.tpl b/client/views/chan.tpl index d9e9d005..351e0b36 100644 --- a/client/views/chan.tpl +++ b/client/views/chan.tpl @@ -1,7 +1,7 @@ {{#each channels}}
{{#if unread}}{{roundBadgeNumber unread}}{{/if}} - + {{#equal type "lobby"}}{{else}}{{/equal}} {{name}}
{{/each}}