diff options
| author | Stephen Blott | 2016-10-23 16:50:48 +0100 |
|---|---|---|
| committer | Stephen Blott | 2016-10-23 16:50:51 +0100 |
| commit | 24a6217f26911ba4e934f4a7bff8bcd30c227163 (patch) | |
| tree | 52aadf4a8a0f639b85740251ff93cca2b8747f28 /content_scripts | |
| parent | 84b3e7d65d6cd7391f5b00cb77398cb60fe245bb (diff) | |
| download | vimium-24a6217f26911ba4e934f4a7bff8bcd30c227163.tar.bz2 | |
Move SearchEngines to bg-utils.coffee.
`SearchEngines` was previously in `utils.coffee`, which means it was
loaded in *every* content frame. This is unnecessary, since it is only
used on the background page. So this PR moves it there.
Also:
- Simplify some unnecessarily complex logic in `vomnibar.coffee`.
- Re-use `Utils.parseLines()` to parse the custom search engine configuation text.
Diffstat (limited to 'content_scripts')
| -rw-r--r-- | content_scripts/vomnibar.coffee | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/content_scripts/vomnibar.coffee b/content_scripts/vomnibar.coffee index 49c4288e..04499523 100644 --- a/content_scripts/vomnibar.coffee +++ b/content_scripts/vomnibar.coffee @@ -4,22 +4,19 @@ Vomnibar = vomnibarUI: null - # 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) -> - searchEngines = Settings.get("searchEngines") ? "" - SearchEngines.refreshAndUse searchEngines, (engines) -> - callback? registryEntry.options + # Extract any additional options from the command's registry entry. + extractOptionsFromRegistryEntry: (registryEntry, callback) -> + callback? extend {}, registryEntry.options # sourceFrameId here (and below) is the ID of the frame from which this request originates, which may be different # from the current frame. activate: (sourceFrameId, registryEntry) -> - @parseRegistryEntry registryEntry, (options) => + @extractOptionsFromRegistryEntry registryEntry, (options) => @open sourceFrameId, extend options, completer:"omni" activateInNewTab: (sourceFrameId, registryEntry) -> - @parseRegistryEntry registryEntry, (options) => + @extractOptionsFromRegistryEntry registryEntry, (options) => @open sourceFrameId, extend options, completer:"omni", newTab: true activateTabSelection: (sourceFrameId) -> @open sourceFrameId, { |
