diff options
| author | ilya | 2010-02-26 22:51:09 -0800 |
|---|---|---|
| committer | ilya | 2010-02-26 22:51:36 -0800 |
| commit | f14d93799552436c1ea0f4706ef4f012f522b885 (patch) | |
| tree | 98632ff0c6bcfebd7572b9d0c9e05eda437610f1 | |
| parent | f4a0f8b79678fd8d67f1ccb140f838df04a7313a (diff) | |
| download | vimium-f14d93799552436c1ea0f4706ef4f012f522b885.tar.bz2 | |
Key Mapping - Add support for comments in the mappings text.
| -rw-r--r-- | commands.js | 13 | ||||
| -rw-r--r-- | options.html | 2 |
2 files changed, 9 insertions, 6 deletions
diff --git a/commands.js b/commands.js index d7c8b12a..77277c73 100644 --- a/commands.js +++ b/commands.js @@ -27,16 +27,17 @@ function parseCustomKeyMappings(customKeyMappings) { lines = customKeyMappings.split("\n"); for (var i = 0; i < lines.length; i++) { - line = lines[i].split(" "); // TODO(ilya): Support all whitespace. - if (line.length < 2) { continue } + if (lines[i][0] == "\"" || lines[i][0] == "#") { continue } + split_line = lines[i].split(" "); // TODO(ilya): Support all whitespace. + if (split_line.length < 2) { continue } - var lineCommand = line[0]; - var key = line[1]; + var lineCommand = split_line[0]; + var key = split_line[1]; if (lineCommand == "map") { - if (line.length != 3) { continue } + if (split_line.length != 3) { continue } - var vimiumCommand = line[2]; + var vimiumCommand = split_line[2]; if (!availableCommands[vimiumCommand]) { continue } diff --git a/options.html b/options.html index 6110b09e..5fc965a3 100644 --- a/options.html +++ b/options.html @@ -193,6 +193,8 @@ Enter commands to remap your keys. Available commands:<br/> map j scrollDown<br/> unmap j</br> + " this is a comment<br/> + # this is also a comment<br/> </div> </div> <textarea id="keyMappings" type="text"></textarea> |
