Skip to content
This repository has been archived by the owner on Dec 11, 2019. It is now read-only.

Commit

Permalink
Merge pull request #12698 from brave/fix/local-favicons
Browse files Browse the repository at this point in the history
Load search favicons locally in about:preferences
  • Loading branch information
diracdeltas committed Jan 18, 2018
1 parent f63a55a commit 2f9a6ca
Show file tree
Hide file tree
Showing 22 changed files with 32 additions and 1 deletion.
Binary file added app/extensions/brave/img/favicons/amazon.ico
Binary file not shown.
Binary file added app/extensions/brave/img/favicons/bing.ico
Binary file not shown.
Binary file added app/extensions/brave/img/favicons/duckduckgo.ico
Binary file not shown.
Binary file added app/extensions/brave/img/favicons/ecosia.ico
Binary file not shown.
Binary file added app/extensions/brave/img/favicons/findx.ico
Binary file not shown.
Binary file added app/extensions/brave/img/favicons/github.ico
Binary file not shown.
Binary file added app/extensions/brave/img/favicons/google.ico
Binary file not shown.
Binary file not shown.
Binary file added app/extensions/brave/img/favicons/mdn.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/extensions/brave/img/favicons/qwant.ico
Binary file not shown.
Binary file added app/extensions/brave/img/favicons/searx.ico
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file added app/extensions/brave/img/favicons/startpage.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/extensions/brave/img/favicons/twitter.ico
Binary file not shown.
Binary file added app/extensions/brave/img/favicons/wikipedia.ico
Binary file not shown.
Binary file not shown.
Binary file added app/extensions/brave/img/favicons/yahoo.ico
Binary file not shown.
Binary file added app/extensions/brave/img/favicons/yandex.ico
Binary file not shown.
Binary file added app/extensions/brave/img/favicons/youtube.ico
Binary file not shown.
2 changes: 1 addition & 1 deletion js/about/preferences.js
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ class SearchTab extends ImmutableComponent {
const iconSize = 16
entries.forEach((entry) => {
let iconStyle = {
backgroundImage: `url(${entry.image})`,
backgroundImage: `url(${entry.localImage})`,
minWidth: iconSize,
width: iconSize,
backgroundSize: iconSize,
Expand Down
31 changes: 31 additions & 0 deletions js/data/searchProviders.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,24 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */

const {braveExtensionId} = require('../constants/config')

/**
* Returns chrome-extension:// URL of a favicon resource
* @param {string} name - Name of the resource
* @param {string} ext - Filename extension
*/
const getFaviconUrl = (name, ext = 'ico') => {
return `chrome-extension://${braveExtensionId}/img/favicons/${name}.${ext}`
}

module.exports = { "providers" :
[
{
"name" : "Amazon",
"base" : "https://www.amazon.com",
"image" : "https://www.amazon.com/favicon.ico",
"localImage" : getFaviconUrl('amazon'),
"search" : "https://www.amazon.com/exec/obidos/external-search/?field-keywords={searchTerms}&mode=blended",
"autocomplete" : "https://completion.amazon.com/search/complete?method=completion&q={searchTerms}&search-alias=aps&client=amazon-search-ui&mkt=1",
"shortcut" : ":a"
Expand All @@ -16,6 +28,7 @@ module.exports = { "providers" :
"name" : "Bing",
"base" : "https://www.bing.com",
"image" : "https://www.bing.com/favicon.ico",
"localImage" : getFaviconUrl('bing'),
"search" : "https://www.bing.com/search?q={searchTerms}",
"autocomplete" : "https://api.bing.com/osjson.aspx?query={searchTerms}&language={language}&form=OSDJAS",
"shortcut" : ":b"
Expand All @@ -24,6 +37,7 @@ module.exports = { "providers" :
"name" : "DuckDuckGo",
"base" : "https://duckduckgo.com",
"image" : "https://duckduckgo.com/favicon.ico",
"localImage" : getFaviconUrl('duckduckgo'),
"search" : "https://duckduckgo.com/?q={searchTerms}&t=brave",
"autocomplete" : "https://ac.duckduckgo.com/ac/?q={searchTerms}&type=list",
"shortcut" : ":d"
Expand All @@ -32,13 +46,15 @@ module.exports = { "providers" :
"name" : "GitHub",
"base" : "https://github.com/search",
"image" : "https://assets-cdn.github.com/favicon.ico",
"localImage" : getFaviconUrl('github'),
"search" : "https://github.com/search?q={searchTerms}",
"shortcut" : ":gh"
},
{
"name" : "Google",
"base" : "https://www.google.com",
"image" : "https://www.google.com/favicon.ico",
"localImage" : getFaviconUrl('google'),
"search" : "https://www.google.com/search?q={searchTerms}",
"autocomplete" : "https://suggestqueries.google.com/complete/search?client=chrome&q={searchTerms}",
"shortcut" : ":g"
Expand All @@ -47,34 +63,39 @@ module.exports = { "providers" :
"name" : "Stack Overflow",
"base" : "https://stackoverflow.com/search",
"image" : "https://cdn.sstatic.net/sites/stackoverflow/img/favicon.ico",
"localImage" : getFaviconUrl('stackoverflow'),
"search" : "https://stackoverflow.com/search?q={searchTerms}",
"shortcut" : ":s"
},
{
"name" : "MDN Web Docs",
"base": "https://developer.mozilla.org/search",
"image" : "https://developer.cdn.mozilla.net/static/img/favicon32.png",
"localImage" : getFaviconUrl('mdn', 'png'),
"search" : "https://developer.mozilla.org/search?q={searchTerms}",
"shortcut" : ":m"
},
{
"name" : "Twitter",
"base" : "https://twitter.com",
"image" : "https://twitter.com/favicon.ico",
"localImage" : getFaviconUrl('twitter'),
"search" : "https://twitter.com/search?q={searchTerms}&source=desktop-search",
"shortcut" : ":t"
},
{
"name" : "Wikipedia",
"base" : "https://en.wikipedia.org",
"image" : "https://en.wikipedia.org/favicon.ico",
"localImage" : getFaviconUrl('wikipedia'),
"search" : "https://en.wikipedia.org/wiki/Special:Search?search={searchTerms}",
"shortcut" : ":w"
},
{
"name" : "Yahoo",
"base" : "https://search.yahoo.com",
"image" : "https://search.yahoo.com/favicon.ico",
"localImage" : getFaviconUrl('yahoo'),
"search" : "https://search.yahoo.com/search?p={searchTerms}&fr=opensearch",
"autocomplete": "https://search.yahoo.com/sugg/os?command={searchTerms}&output=fxjson&fr=opensearch",
"shortcut" : ":y"
Expand All @@ -83,6 +104,7 @@ module.exports = { "providers" :
"name" : "YouTube",
"base" : "https://www.youtube.com",
"image" : "https://www.youtube.com/favicon.ico",
"localImage" : getFaviconUrl('youtube'),
"search" : "https://www.youtube.com/results?search_type=search_videos&search_query={searchTerms}&search_sort=relevance&search_category=0&page=",
"autocomplete": "https://suggestqueries.google.com/complete/search?output=chrome&client=chrome&hl=it&q={searchTerms}&ds=yt",
"shortcut" : ":yt"
Expand All @@ -91,6 +113,7 @@ module.exports = { "providers" :
"name" : "StartPage",
"base" : "https://www.startpage.com",
"image" : "https://www.startpage.com/graphics/favicon/sp-favicon-16x16.png",
"localImage" : getFaviconUrl('startpage', 'png'),
"search" : "https://www.startpage.com/do/dsearch?query={searchTerms}&cat=web&pl=opensearch",
"autocomplete": "https://www.startpage.com/cgi-bin/csuggest?query={searchTerms}&limit=10&format=json",
"shortcut" : ":sp"
Expand All @@ -99,6 +122,7 @@ module.exports = { "providers" :
"name" : "Infogalactic",
"base" : "https://infogalactic.com",
"image" : "https://infogalactic.com/favicon.ico",
"localImage" : getFaviconUrl('infogalactic'),
"search" : "https://infogalactic.com/w/index.php?title=Special:Search&search={searchTerms}",
"autocomplete": "https://infogalactic.com/w/api.php?action=opensearch&search={searchTerms}&namespace=0",
"shortcut" : ":i"
Expand All @@ -107,20 +131,23 @@ module.exports = { "providers" :
"name" : "Wolfram Alpha",
"base" : "https://www.wolframalpha.com",
"image" : "https://www.wolframalpha.com/favicon.ico?v=2",
"localImage" : getFaviconUrl('wolframalpha'),
"search" : "https://www.wolframalpha.com/input/?i={searchTerms}",
"shortcut" : ":wa"
},
{
"name" : "Semantic Scholar",
"base" : "https://www.semanticscholar.org",
"image" : "https://www.semanticscholar.org/img/favicon.png",
"localImage" : getFaviconUrl('semanticscholar', 'png'),
"search" : "https://www.semanticscholar.org/search?q={searchTerms}",
"shortcut" : ":ss"
},
{
"name" : "Qwant",
"base" : "https://www.qwant.com/",
"image" : "https://www.qwant.com/favicon.ico",
"localImage" : getFaviconUrl('qwant'),
"search" : "https://www.qwant.com/?q={searchTerms}&client=brave",
"autocomplete": "https://api.qwant.com/api/suggest/?q={searchTerms}&client=brave",
"shortcut" : ":q"
Expand All @@ -129,13 +156,15 @@ module.exports = { "providers" :
"name" : "Yandex",
"base" : "https://yandex.com",
"image" : "https://www.yandex.com/favicon.ico",
"localImage" : getFaviconUrl('yandex'),
"search" : "https://yandex.com/search/?text={searchTerms}&clid=2274777",
"shortcut" : ":ya"
},
{
"name" : "Ecosia",
"base" : "https://www.ecosia.org/",
"image" : "https://cdn.ecosia.org/assets/images/ico/favicon.ico",
"localImage" : getFaviconUrl('ecosia'),
"search" : "https://www.ecosia.org/search?q={searchTerms}",
"autocomplete": "https://ac.ecosia.org/autocomplete?q={searchTerms}&type=list",
"shortcut" : ":e"
Expand All @@ -144,13 +173,15 @@ module.exports = { "providers" :
"name" : "searx",
"base" : "https://searx.me",
"image" : "https://searx.me/favicon.ico",
"localImage" : getFaviconUrl('searx'),
"search" : "https://searx.me/?q={searchTerms}&categories=general",
"shortcut" : ":x"
},
{
"name": "findx",
"base": "https://www.findx.com",
"image": "https://www.findx.com/favicon.ico",
"localImage" : getFaviconUrl('findx'),
"search": "https://www.findx.com/search?q={searchTerms}&type=web",
"autocomplete": "https://www.findx.com/api/web-search/suggestions/?q={searchTerms}&type=opensearch",
"shortcut": ":fx"
Expand Down

0 comments on commit 2f9a6ca

Please sign in to comment.