diff options
| author | Stephen Blott | 2015-05-14 05:44:02 +0100 |
|---|---|---|
| committer | Stephen Blott | 2015-05-14 05:44:02 +0100 |
| commit | 8a83eda8402fa836a66ef9c3632f416569ab9382 (patch) | |
| tree | eaa2c32ba5ad31093531ad33a44b4a48df5ce19c /background_scripts/completion_engines.coffee | |
| parent | dec174a9d60cb49e386563975bb3aecfd7209879 (diff) | |
| download | vimium-8a83eda8402fa836a66ef9c3632f416569ab9382.tar.bz2 | |
Search completion; add Merriam-Webster.
Diffstat (limited to 'background_scripts/completion_engines.coffee')
| -rw-r--r-- | background_scripts/completion_engines.coffee | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/background_scripts/completion_engines.coffee b/background_scripts/completion_engines.coffee index 49569b5d..189f66f3 100644 --- a/background_scripts/completion_engines.coffee +++ b/background_scripts/completion_engines.coffee @@ -102,6 +102,12 @@ class DuckDuckGo extends RegexpEngine parse: (xhr) -> suggestion.phrase for suggestion in JSON.parse xhr.responseText +class Webster extends RegexpEngine + # Example search URL: http://www.merriam-webster.com/dictionary/%s + constructor: -> super [ new RegExp "^https?://www.merriam-webster.com/dictionary/" ] + getUrl: (queryTerms) -> Utils.createSearchUrl queryTerms, "http://www.merriam-webster.com/autocomplete?query=%s" + parse: (xhr) -> JSON.parse(xhr.responseText).suggestions + # A dummy search engine which is guaranteed to match any search URL, but never produces completions. This # allows the rest of the logic to be written knowing that there will always be a completion engine match. class DummyCompletionEngine @@ -119,6 +125,7 @@ CompletionEngines = [ Wikipedia Bing Amazon + Webster DummyCompletionEngine ] |
