Improved keybindings

This commit is contained in:
Mattias Erming 2014-08-14 12:26:36 -07:00
parent 67375a2600
commit c78c577637
3 changed files with 20 additions and 11 deletions

View file

@ -462,17 +462,25 @@ $(function() {
);
});
Mousetrap.bind(["ctrl+up", "ctrl+down"], function(e, keys) {
var active = sidebar.find(".active");
switch (keys) {
case "ctrl+up":
var prev = active.prev(".chan");
prev.click();
Mousetrap.bind([
"command+up",
"command+down",
"ctrl+up",
"ctrl+down"
], function(e, keys) {
var channels = sidebar.find(".chan");
var index = channels.index(channels.filter(".active"));
var direction = keys.split("+").pop();
switch (direction) {
case "up":
var i = Math.max(0, index - 1);
channels.eq(i).click();
break;
case "ctrl+down":
var next = active.next(".chan");
next.click();
case "down":
var i = Math.min(channels.length, index + 1);
channels.eq(i).click();
break;
}
});

File diff suppressed because one or more lines are too long

View file

@ -49,7 +49,8 @@
case 38: // Up
case 40: // Down
if (e.ctrlKey) {
// NOTICE: This is specific to the Shout client.
if (e.ctrlKey || e.metaKey) {
break;
}
history[i] = self.val();