From 32895a96b3da225bd1b46d4b96ab98fd71755281 Mon Sep 17 00:00:00 2001 From: Stephen Blott Date: Tue, 5 May 2015 16:16:59 +0100 Subject: Search completion; changes in response to @mrmr1993. --- background_scripts/completion.coffee | 8 ++++---- background_scripts/search_engines.coffee | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'background_scripts') diff --git a/background_scripts/completion.coffee b/background_scripts/completion.coffee index 92936098..39f8a140 100644 --- a/background_scripts/completion.coffee +++ b/background_scripts/completion.coffee @@ -34,17 +34,15 @@ class Suggestion generateHtml: -> return @html if @html relevancyHtml = if @showRelevancy then "#{@computeRelevancy()}" else "" - highlightTerms = - if @noHighlightTerms then ((s) -> Utils.escapeHtml s) else ((s) => @highlightTerms Utils.escapeHtml s) # NOTE(philc): We're using these vimium-specific class names so we don't collide with the page's CSS. @html = """
#{@type} - #{highlightTerms @title} + #{@highlightTerms Utils.escapeHtml @title}
- #{@shortenUrl highlightTerms @url} + #{@shortenUrl @highlightTerms Utils.escapeHtml @url} #{relevancyHtml}
""" @@ -85,6 +83,7 @@ class Suggestion # Wraps each occurence of the query terms in the given string in a . highlightTerms: (string) -> + return string if @noHighlightTerms ranges = [] escapedTerms = @queryTerms.map (term) -> Utils.escapeHtml(term) for term in escapedTerms @@ -399,6 +398,7 @@ class SearchEngineCompleter count = Math.min 6, Math.max 3, MultiCompleter.maxResults - existingSuggestions.length onComplete suggestions[...count] + # FIXME(smblott) Refactor Suggestion constructor as per @mrmr1993's comment in #1635. mkSuggestion: (insertText, args...) -> suggestion = new Suggestion args... extend suggestion, insertText: insertText, noHighlightTerms: true diff --git a/background_scripts/search_engines.coffee b/background_scripts/search_engines.coffee index 74e752e3..63c61a47 100644 --- a/background_scripts/search_engines.coffee +++ b/background_scripts/search_engines.coffee @@ -34,7 +34,7 @@ class Google extends GoogleXMLRegexpEngine constructor: -> super [ # We match the major English-speaking TLDs. - new RegExp "^https?://[a-z]+\.google\.(com|ie|co.uk|ca|com.au)/" + new RegExp "^https?://[a-z]+\.google\.(com|ie|co\.uk|ca|com\.au)/" new RegExp "localhost/cgi-bin/booky" # Only for smblott. ] -- cgit v1.2.3