diff options
| author | Stephen Blott | 2014-10-27 11:26:58 +0000 | 
|---|---|---|
| committer | Stephen Blott | 2014-10-27 11:26:58 +0000 | 
| commit | 54b597bb1562f9d1c1aa13141cf2d1c33ce66b63 (patch) | |
| tree | 77a4c19f0f24c1816184428f6757d404f6093f90 | |
| parent | 2e8ac9c4847d0088443b5d961c44096c293cd1c0 (diff) | |
| parent | 7c2f6c56000b5af5e86d97b535d02e24a7d1b322 (diff) | |
| download | vimium-54b597bb1562f9d1c1aa13141cf2d1c33ce66b63.tar.bz2 | |
Merge favicons for vomnibar.
| -rw-r--r-- | background_scripts/completion.coffee | 13 | ||||
| -rw-r--r-- | content_scripts/vimium.css | 7 | 
2 files changed, 19 insertions, 1 deletions
| diff --git a/background_scripts/completion.coffee b/background_scripts/completion.coffee index b0ab4b88..b52d9eb8 100644 --- a/background_scripts/completion.coffee +++ b/background_scripts/completion.coffee @@ -26,6 +26,7 @@ class Suggestion    generateHtml: ->      return @html if @html +    favIconUrl = @tabFavIconUrl or "#{@getUrlRoot(@url)}/favicon.ico"      relevancyHtml = if @showRelevancy then "<span class='relevancy'>#{@computeRelevancy()}</span>" else ""      # NOTE(philc): We're using these vimium-specific class names so we don't collide with the page's CSS.      @html = @@ -34,12 +35,21 @@ class Suggestion           <span class="vimiumReset vomnibarSource">#{@type}</span>           <span class="vimiumReset vomnibarTitle">#{@highlightTerms(Utils.escapeHtml(@title))}</span>         </div> -       <div class="vimiumReset vomnibarBottomHalf"> +       <div class="vimiumReset vomnibarBottomHalf vomnibarIcon" +            style="background-image: url(#{favIconUrl});">          <span class="vimiumReset vomnibarUrl">#{@shortenUrl(@highlightTerms(Utils.escapeHtml(@url)))}</span>          #{relevancyHtml}        </div>        """ +  # Use neat trick to snatch a domain (http://stackoverflow.com/a/8498668). +  # TODO(smblott) Is this really faster than using parseUri?  That's probably what's happening behind the +  # scenes anyway. +  getUrlRoot: (url) -> +    a = document.createElement 'a' +    a.href = url +    a.protocol + "//" + a.hostname +    shortenUrl: (url) -> @stripTrailingSlash(url).replace(/^https?:\/\//, "")    stripTrailingSlash: (url) -> @@ -261,6 +271,7 @@ class TabCompleter        suggestions = results.map (tab) =>          suggestion = new Suggestion(queryTerms, "tab", tab.url, tab.title, @computeRelevancy)          suggestion.tabId = tab.id +        suggestion.tabFavIconUrl = tab.favIconUrl          suggestion        onComplete(suggestions) diff --git a/content_scripts/vimium.css b/content_scripts/vimium.css index 7998fe5c..24f229f3 100644 --- a/content_scripts/vimium.css +++ b/content_scripts/vimium.css @@ -352,6 +352,13 @@ body.vimiumFindMode ::selection {    padding: 2px 0;  } +#vomnibar li .vomnibarIcon { +  background-position-y: center; +  background-size: 16px; +  background-repeat: no-repeat; +  padding-left: 20px; +} +  #vomnibar li .vomnibarSource {    color: #777;    margin-right: 4px; | 
