From 68205d32188cd94c4c533d8bacc8a2b384821bae Mon Sep 17 00:00:00 2001 From: Stephen Blott Date: Thu, 13 Oct 2016 08:21:51 +0100 Subject: 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. --- content_scripts/link_hints.coffee | 15 ++++++++------- content_scripts/vimium_frontend.coffee | 5 +++-- 2 files changed, 11 insertions(+), 9 deletions(-) (limited to 'content_scripts') 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. -- cgit v1.2.3