diff options
Diffstat (limited to 'background_scripts')
| -rw-r--r-- | background_scripts/completion.coffee | 8 | ||||
| -rw-r--r-- | background_scripts/search_engines.coffee | 2 |
2 files changed, 5 insertions, 5 deletions
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 "<span class='relevancy'>#{@computeRelevancy()}</span>" 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 = """ <div class="vimiumReset vomnibarTopHalf"> <span class="vimiumReset vomnibarSource">#{@type}</span> - <span class="vimiumReset vomnibarTitle">#{highlightTerms @title}</span> + <span class="vimiumReset vomnibarTitle">#{@highlightTerms Utils.escapeHtml @title}</span> </div> <div class="vimiumReset vomnibarBottomHalf"> - <span class="vimiumReset vomnibarUrl">#{@shortenUrl highlightTerms @url}</span> + <span class="vimiumReset vomnibarUrl">#{@shortenUrl @highlightTerms Utils.escapeHtml @url}</span> #{relevancyHtml} </div> """ @@ -85,6 +83,7 @@ class Suggestion # Wraps each occurence of the query terms in the given string in a <span>. 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. ] |
