diff --git a/client/js/keybinds.js b/client/js/keybinds.js index e71ab3ce..f702e341 100644 --- a/client/js/keybinds.js +++ b/client/js/keybinds.js @@ -57,6 +57,38 @@ Mousetrap.bind([ channels.eq(target).click(); }); +Mousetrap.bind([ + "alt+shift+up", + "alt+shift+down", +], function(e, keys) { + const lobbies = sidebar.find(".lobby"); + const direction = keys.split("+").pop(); + let index = lobbies.index(lobbies.filter(".active")); + let target; + + switch (direction) { + case "up": + if (index < 0) { + target = lobbies.index(sidebar.find(".channel").filter(".active").siblings(".lobby")[0]); + } else { + target = (lobbies.length + (index - 1 + lobbies.length)) % lobbies.length; + } + + break; + + case "down": + if (index < 0) { + index = lobbies.index(sidebar.find(".channel").filter(".active").siblings(".lobby")[0]); + } + + target = (lobbies.length + (index + 1 + lobbies.length)) % lobbies.length; + + break; + } + + lobbies.eq(target).click(); +}); + Mousetrap.bind([ "escape", ], function() { diff --git a/client/views/windows/help.tpl b/client/views/windows/help.tpl index 22a7e2ef..e97cd92e 100644 --- a/client/views/windows/help.tpl +++ b/client/views/windows/help.tpl @@ -47,6 +47,15 @@

Keyboard Shortcuts

+
+
+ Alt + Shift + / +
+
+

Switch to the previous/next lobby in the channel list.

+
+
+
Alt + /