diff --git a/client/js/lounge.js b/client/js/lounge.js index 7fdb4f5c..07f7c5ce 100644 --- a/client/js/lounge.js +++ b/client/js/lounge.js @@ -174,7 +174,7 @@ $(function() { }); viewport.on("click", "#chat .menu", function(e) { - e.currentTarget = $(e.currentTarget).closest(".chan")[0]; + e.currentTarget = $(`#sidebar .chan[data-id="${$(this).closest(".chan").data("id")}"]`)[0]; return showContextMenu(this, e); }); diff --git a/client/js/socket-events/init.js b/client/js/socket-events/init.js index 621984cd..f2cd9fc1 100644 --- a/client/js/socket-events/init.js +++ b/client/js/socket-events/init.js @@ -64,8 +64,7 @@ function openCorrectChannel(clientActive, serverActive) { // Open window provided in location.hash if (target.length === 0 && window.location.hash) { - target = $("#footer, #sidebar, #help") - .find(`[data-target="${escape(window.location.hash)}"]`); + target = $(`[data-target="${escape(window.location.hash)}"]`).first(); } // Open last active channel according to the server diff --git a/client/views/chat.tpl b/client/views/chat.tpl index b5b32d30..16d287bb 100644 --- a/client/views/chat.tpl +++ b/client/views/chat.tpl @@ -1,5 +1,11 @@ {{#each channels}} -
+
{{#equal type "channel"}}