Add keybinds for cycling through networks/lobbies
This commit is contained in:
parent
0dc76e773f
commit
c0f430e509
@ -58,6 +58,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() {
|
||||
|
@ -47,6 +47,15 @@
|
||||
|
||||
<h2>Keyboard Shortcuts</h2>
|
||||
|
||||
<div class="help-item">
|
||||
<div class="subject">
|
||||
<kbd class="key-all">Alt</kbd><kbd class="key-apple">⌥</kbd> + <kbd>Shift</kbd> + <kbd>↑</kbd> / <kbd>↓</kbd>
|
||||
</div>
|
||||
<div class="description">
|
||||
<p>Switch to the previous/next lobby in the channel list.</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="help-item">
|
||||
<div class="subject">
|
||||
<kbd class="key-all">Alt</kbd><kbd class="key-apple">⌥</kbd> + <kbd>↑</kbd> / <kbd>↓</kbd>
|
||||
|
Loading…
Reference in New Issue
Block a user