From 6487c09d98b791b3211679d2f1bf970394a696e6 Mon Sep 17 00:00:00 2001 From: Stephen Blott Date: Sat, 27 Feb 2016 16:05:23 +0000 Subject: Key bindings; rewire vomnibar. --- content_scripts/vimium_frontend.coffee | 10 ++++------ content_scripts/vomnibar.coffee | 1 - 2 files changed, 4 insertions(+), 7 deletions(-) (limited to 'content_scripts') diff --git a/content_scripts/vimium_frontend.coffee b/content_scripts/vimium_frontend.coffee index 0cb402b8..4acac352 100644 --- a/content_scripts/vimium_frontend.coffee +++ b/content_scripts/vimium_frontend.coffee @@ -120,7 +120,6 @@ window.initializeModes = -> You have asked Vimium to perform #{count} repeats of the command: #{registryEntry.description}.\n Are you sure you want to continue? """ - # TODO: Special handling of Vomnibar. if registryEntry.isBackgroundCommand chrome.runtime.sendMessage { handler: "runBackgroundCommand", frameId, registryEntry, count} else @@ -136,6 +135,9 @@ window.initializeModes = -> new InsertMode permanent: true Scroller.init() +openVomnibar = ({sourceFrameId, registryEntry}) -> + Utils.invokeCommandString registryEntry.command, [sourceFrameId, registryEntry] if DomUtils.isTopFrame() + # # Complete initialization work that sould be done prior to DOMReady. # @@ -151,6 +153,7 @@ initializePreDomReady = -> # A frame has received the focus. We don't care here (the Vomnibar/UI-component handles this). frameFocused: -> checkEnabledAfterURLChange: checkEnabledAfterURLChange + openVomnibar: openVomnibar chrome.runtime.onMessage.addListener (request, sender, sendResponse) -> # In the options page, we will receive requests from both content and background scripts. ignore those @@ -162,11 +165,6 @@ initializePreDomReady = -> shouldHandleRequest = isEnabledForUrl # We always handle the message if it's one of these listed message types. shouldHandleRequest ||= request.name in [ "checkEnabledAfterURLChange" ] - # Requests with a frameId of zero should always and only be handled in the main/top frame (regardless of - # whether Vimium is enabled there). - if request.frameId == 0 and DomUtils.isTopFrame() - request.frameId = frameId - shouldHandleRequest = true sendResponse requestHandlers[request.name](request, sender) if shouldHandleRequest # Ensure the sendResponse callback is freed. false diff --git a/content_scripts/vomnibar.coffee b/content_scripts/vomnibar.coffee index 55a46777..67a79ff4 100644 --- a/content_scripts/vomnibar.coffee +++ b/content_scripts/vomnibar.coffee @@ -7,7 +7,6 @@ Vomnibar = # Parse any additional options from the command's registry entry. Currently, this only includes a flag of # the form "keyword=X", for direct activation of a custom search engine. parseRegistryEntry: (registryEntry = { options: [] }, callback = null) -> - options = {} searchEngines = Settings.get("searchEngines") ? "" SearchEngines.refreshAndUse searchEngines, (engines) -> callback? registryEntry.options -- cgit v1.2.3