diff options
| author | Stephen Blott | 2015-05-31 14:04:28 +0100 |
|---|---|---|
| committer | Stephen Blott | 2015-05-31 14:04:28 +0100 |
| commit | 01a6df1f155b8b068925cc813d663457edc860e8 (patch) | |
| tree | 83c6395dd3737bc3c93a5ec1a023a67d93a3c0ef /background_scripts | |
| parent | 8891134fd5bd70a65beb9fce81e3f44dbc062447 (diff) | |
| download | vimium-01a6df1f155b8b068925cc813d663457edc860e8.tar.bz2 | |
Re-write class with inheritence.
Diffstat (limited to 'background_scripts')
| -rw-r--r-- | background_scripts/completion_engines.coffee | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/background_scripts/completion_engines.coffee b/background_scripts/completion_engines.coffee index 9a88d491..48f94965 100644 --- a/background_scripts/completion_engines.coffee +++ b/background_scripts/completion_engines.coffee @@ -43,15 +43,15 @@ class Google extends GoogleXMLRegexpEngine # A wrapper class for Google completions. This adds prefix terms to the query, and strips those terms from # the resulting suggestions. For example, for Google Maps, we add "map of" as a prefix, then strip "map of" # from the resulting suggestions. -class GoogleWithPrefix +class GoogleWithPrefix extends Google constructor: (prefix, args...) -> - @engine = new Google args... - @prefix = "#{prefix.trim()} " - @queryTerms = @prefix.split /\s+/ - match: (args...) -> @engine.match args... - getUrl: (queryTerms) -> @engine.getUrl [ @queryTerms..., queryTerms... ] + super args... + prefix = prefix.trim() + @prefix = "#{prefix} " + @queryTerms = prefix.split /\s+/ + getUrl: (queryTerms) -> super [ @queryTerms..., queryTerms... ] parse: (xhr) -> - @engine.parse(xhr) + super(xhr) .filter (suggestion) => suggestion.startsWith @prefix .map (suggestion) => suggestion[@prefix.length..].ltrim() |
