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) { Mousetrap.bind([
var active = sidebar.find(".active"); "command+up",
switch (keys) { "command+down",
case "ctrl+up": "ctrl+up",
var prev = active.prev(".chan"); "ctrl+down"
prev.click(); ], 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; break;
case "ctrl+down": case "down":
var next = active.next(".chan"); var i = Math.min(channels.length, index + 1);
next.click(); channels.eq(i).click();
break; break;
} }
}); });

File diff suppressed because one or more lines are too long

View File

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