diff options
| author | Conrad Irwin | 2010-05-29 03:28:36 +0100 |
|---|---|---|
| committer | Phil Crosby | 2010-06-01 21:55:48 -0700 |
| commit | 9d0061dca6101926da760e159d50151984ae24f8 (patch) | |
| tree | 4405a8015e4526e68b98886c0c3f99fc16ec1d7d /commands.js | |
| parent | 3b412ce951643214f5e0f943e10ff9302fe001b9 (diff) | |
| download | vimium-9d0061dca6101926da760e159d50151984ae24f8.tar.bz2 | |
Allow mapping to arrow keys and f-keys
Conflicts:
commands.js
Diffstat (limited to 'commands.js')
| -rw-r--r-- | commands.js | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/commands.js b/commands.js index 08481280..8e4922f3 100644 --- a/commands.js +++ b/commands.js @@ -23,6 +23,11 @@ function mapKeyToCommand(key, command) { function unmapKey(key) { delete keyToCommandRegistry[key]; } +function normalizeKey(key) { + return key.replace(/<[amc]-/i, function(m){return m.toLowerCase();}) + .replace(/<([acm]-)?([a-zA-Z0-9]+)>/, function(m, p, k){return "<" + (p ? p : "") + k.toLowerCase() + ">";}); +} + function parseCustomKeyMappings(customKeyMappings) { lines = customKeyMappings.split("\n"); @@ -34,7 +39,7 @@ function parseCustomKeyMappings(customKeyMappings) { if (lineCommand == "map") { if (split_line.length != 3) { continue; } - var key = split_line[1]; + var key = normalizeKey(split_line[1]); var vimiumCommand = split_line[2]; if (!availableCommands[vimiumCommand]) { continue } @@ -45,7 +50,7 @@ function parseCustomKeyMappings(customKeyMappings) { else if (lineCommand == "unmap") { if (split_line.length != 2) { continue; } - var key = split_line[1]; + var key = normalizeKey(split_line[1]); console.log("Unmapping", key); unmapKey(key); |
