diff options
Diffstat (limited to 'background_scripts/completion_engines.coffee')
| -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() | 
