diff options
Diffstat (limited to 'commands.js')
| -rw-r--r-- | commands.js | 18 | 
1 files changed, 12 insertions, 6 deletions
| diff --git a/commands.js b/commands.js index fa24dee8..a9fa0aba 100644 --- a/commands.js +++ b/commands.js @@ -1,14 +1,17 @@  var availableCommands    = {};  var keyToCommandRegistry = {}; -function addCommand(command, description, isBackgroundCommand) { +function addCommand(command, description, isBackgroundCommand, passCountToFunction) {    if (availableCommands[command])    {      console.log(command, "is already defined! Check commands.js for duplicates.");      return;    } -  availableCommands[command] = { description: description, isBackgroundCommand: isBackgroundCommand }; +  availableCommands[command] = { description: description, +                                 isBackgroundCommand: isBackgroundCommand, +                                 passCountToFunction: passCountToFunction +                               };  }  function mapKeyToCommand(key, command) { @@ -18,7 +21,10 @@ function mapKeyToCommand(key, command) {      return;    } -  keyToCommandRegistry[key] = { command: command, isBackgroundCommand: availableCommands[command].isBackgroundCommand }; +  keyToCommandRegistry[key] = { command: command, +                                isBackgroundCommand: availableCommands[command].isBackgroundCommand, +                                passCountToFunction: availableCommands[command].passCountToFunction +                              };  }  function unmapKey(key) { delete keyToCommandRegistry[key]; } @@ -102,7 +108,7 @@ function clearKeyMappingsAndSetDefaults() {    mapKeyToCommand('zi', 'zoomIn');    mapKeyToCommand('zo', 'zoomOut'); -  mapKeyToCommand('gi', 'focusFirstInput'); +  mapKeyToCommand('gi', 'focusInput');    mapKeyToCommand('f', 'activateLinkHintsMode');    mapKeyToCommand('F', 'activateLinkHintsModeToOpenInNewTab'); @@ -146,7 +152,7 @@ addCommand('copyCurrentUrl',      'Copy the current URL to the clipboard');  addCommand('enterInsertMode',     'Enter insert mode'); -addCommand('focusFirstInput',     'Focus the first text box on the page'); +addCommand('focusInput',          'Focus the first (or n-th) text box on the page', false, true);  addCommand('activateLinkHintsMode',               'Enter link hints mode to open links in current tab');  addCommand('activateLinkHintsModeToOpenInNewTab', 'Enter link hints mode to open links in new tab'); @@ -178,7 +184,7 @@ var commandGroups = {       "scrollToTop", "scrollToBottom", "scrollToLeft", "scrollToRight", "scrollPageDown",       "scrollPageUp", "scrollFullPageDown",       "reload", "toggleViewSource", "zoomIn", "zoomOut", "copyCurrentUrl", "goUp", -     "enterInsertMode", "focusFirstInput", +     "enterInsertMode", "focusInput",       "activateLinkHintsMode", "activateLinkHintsModeToOpenInNewTab",       "enterFindMode", "performFind", "performBackwardsFind"],    historyNavigation: | 
