aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephen Blott2016-10-13 08:21:51 +0100
committerStephen Blott2016-10-15 06:53:44 +0100
commit68205d32188cd94c4c533d8bacc8a2b384821bae (patch)
treec91ee5097c9dc60931fa9be7e0b7f9d34be98147
parent1eb6bfdcad6d7091911e395083afe1148b2a4c76 (diff)
downloadvimium-68205d32188cd94c4c533d8bacc8a2b384821bae.tar.bz2
No-op; rearrange content-script command arguments.
This is a no-op. It arranges that the registry entry for each command is passed to the command, for every command. That required a small ammount of reworking in a couple of cases.
-rw-r--r--content_scripts/link_hints.coffee15
-rw-r--r--content_scripts/vimium_frontend.coffee5
2 files changed, 11 insertions, 9 deletions
diff --git a/content_scripts/link_hints.coffee b/content_scripts/link_hints.coffee
index 783e6369..02b8d656 100644
--- a/content_scripts/link_hints.coffee
+++ b/content_scripts/link_hints.coffee
@@ -121,7 +121,8 @@ HintCoordinator =
@linkHintsMode = @localHints = null
LinkHints =
- activateMode: (count = 1, mode = OPEN_IN_CURRENT_TAB) ->
+ activateMode: (count = 1, {mode}) ->
+ mode ?= OPEN_IN_CURRENT_TAB
if 0 < count or mode is OPEN_WITH_QUEUE
HintCoordinator.prepareToActivateMode mode, (isSuccess) ->
if isSuccess
@@ -129,12 +130,12 @@ LinkHints =
# which would cause our new mode to exit immediately.
Utils.nextTick -> LinkHints.activateMode count-1, mode
- activateModeToOpenInNewTab: (count) -> @activateMode count, OPEN_IN_NEW_BG_TAB
- activateModeToOpenInNewForegroundTab: (count) -> @activateMode count, OPEN_IN_NEW_FG_TAB
- activateModeToCopyLinkUrl: (count) -> @activateMode count, COPY_LINK_URL
- activateModeWithQueue: -> @activateMode 1, OPEN_WITH_QUEUE
- activateModeToOpenIncognito: (count) -> @activateMode count, OPEN_INCOGNITO
- activateModeToDownloadLink: (count) -> @activateMode count, DOWNLOAD_LINK_URL
+ activateModeToOpenInNewTab: (count) -> @activateMode count, mode: OPEN_IN_NEW_BG_TAB
+ activateModeToOpenInNewForegroundTab: (count) -> @activateMode count, mode: OPEN_IN_NEW_FG_TAB
+ activateModeToCopyLinkUrl: (count) -> @activateMode count, mode: COPY_LINK_URL
+ activateModeWithQueue: -> @activateMode 1, mode: OPEN_WITH_QUEUE
+ activateModeToOpenIncognito: (count) -> @activateMode count, mode: OPEN_INCOGNITO
+ activateModeToDownloadLink: (count) -> @activateMode count, mode: DOWNLOAD_LINK_URL
class LinkHintsMode
hintMarkerContainingDiv: null
diff --git a/content_scripts/vimium_frontend.coffee b/content_scripts/vimium_frontend.coffee
index 11c69808..fcca98ab 100644
--- a/content_scripts/vimium_frontend.coffee
+++ b/content_scripts/vimium_frontend.coffee
@@ -144,7 +144,7 @@ class NormalMode extends KeyHandlerMode
else if registryEntry.background
chrome.runtime.sendMessage {handler: "runBackgroundCommand", registryEntry, count}
else
- Utils.invokeCommandString registryEntry.command, count
+ Utils.invokeCommandString registryEntry.command, count, {registryEntry}
installModes = ->
# Install the permanent modes. The permanently-installed insert mode tracks focus/blur events, and
@@ -393,7 +393,8 @@ extend window,
(event) -> recentlyFocusedElement = event.target if DomUtils.isEditable event.target
, true
- (count, mode = InsertMode) ->
+ (count) ->
+ mode = InsertMode
# Focus the first input element on the page, and create overlays to highlight all the input elements, with
# the currently-focused element highlighted specially. Tabbing will shift focus to the next input element.
# Pressing any other key will remove the overlays and the special tab behavior.