mirror of
https://github.com/thelounge/thelounge
synced 2024-11-23 12:33:07 +00:00
Wrap around when using cmd+up / cmd+down to navigate channels
This commit is contained in:
parent
f101efbd35
commit
e5564bb99d
1 changed files with 6 additions and 2 deletions
|
@ -507,11 +507,15 @@ $(function() {
|
||||||
var direction = keys.split("+").pop();
|
var direction = keys.split("+").pop();
|
||||||
switch (direction) {
|
switch (direction) {
|
||||||
case "up":
|
case "up":
|
||||||
channels.eq(Math.max(0, index - 1)).click();
|
// Wrap around!
|
||||||
|
var upTarget = (channels.length + (index - 1 + channels.length)) % channels.length;
|
||||||
|
channels.eq(upTarget).click();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "down":
|
case "down":
|
||||||
channels.eq(Math.min(channels.length, index + 1)).click();
|
// Wrap aroud!
|
||||||
|
var downTarget = (channels.length + (index + 1 + channels.length)) % channels.length;
|
||||||
|
channels.eq(downTarget).click();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue