From 4c4a319b3362b44cea9a74765bb932070bc6f0ee Mon Sep 17 00:00:00 2001 From: tophf Date: Thu, 27 Jan 2022 05:07:28 +0300 Subject: [PATCH] use duckduckgo favicons --- _locales/bg/messages.json | 2 +- _locales/cs/messages.json | 5 +---- _locales/de/messages.json | 5 +---- _locales/el/messages.json | 2 +- _locales/en/messages.json | 2 +- _locales/es/messages.json | 5 +---- _locales/et/messages.json | 5 +---- _locales/fr/messages.json | 5 +---- _locales/he/messages.json | 2 +- _locales/hu/messages.json | 5 +---- _locales/it/messages.json | 2 +- _locales/ja/messages.json | 5 +---- _locales/ko/messages.json | 5 +---- _locales/nl/messages.json | 5 +---- _locales/pl/messages.json | 5 +---- _locales/pt_BR/messages.json | 3 --- _locales/pt_PT/messages.json | 5 +---- _locales/ro/messages.json | 5 +---- _locales/ru/messages.json | 5 +---- _locales/sv/messages.json | 5 +---- _locales/tr/messages.json | 5 +---- _locales/zh/messages.json | 5 +---- _locales/zh_CN/messages.json | 5 +---- _locales/zh_TW/messages.json | 5 +---- edit/regexp-tester.js | 3 +-- js/toolbox.js | 2 ++ manage/render.js | 7 +++---- 27 files changed, 29 insertions(+), 86 deletions(-) diff --git a/_locales/bg/messages.json b/_locales/bg/messages.json index dff8def9..d3b91312 100644 --- a/_locales/bg/messages.json +++ b/_locales/bg/messages.json @@ -258,7 +258,7 @@ "message": "Сиви" }, "manageFaviconsHelp": { - "message": "Разширението използва външна услуга https://www.google.com/s2/favicons" + "message": "Разширението използва външна услуга https://icons.duckduckgo.com" }, "manageFilters": { "message": "Филтри" diff --git a/_locales/cs/messages.json b/_locales/cs/messages.json index 46b2653c..5b822a84 100644 --- a/_locales/cs/messages.json +++ b/_locales/cs/messages.json @@ -470,7 +470,7 @@ "message": "Zešednutí" }, "manageFaviconsHelp": { - "message": "Stylus používá externí službu https://www.google.com/s2/favicons" + "message": "Stylus používá externí službu https://icons.duckduckgo.com" }, "manageFilters": { "message": "Filtry" @@ -971,9 +971,6 @@ "usercssReplaceTemplateConfirmation": { "message": "Nahradit výchozí šablonu pro nové Usercss styly aktuálním kódem?" }, - "usercssReplaceTemplateName": { - "message": "Prázdné @name nahrazuje výchozí šablonu" - }, "usercssReplaceTemplateSectionBody": { "message": "Sem vložte kód…" }, diff --git a/_locales/de/messages.json b/_locales/de/messages.json index 0bec989e..2697857d 100644 --- a/_locales/de/messages.json +++ b/_locales/de/messages.json @@ -533,7 +533,7 @@ "message": "Ausgegraut" }, "manageFaviconsHelp": { - "message": "Stylus nutzt hierzu den externen Dienst https://www.google.com/s2/favicons" + "message": "Stylus nutzt hierzu den externen Dienst https://icons.duckduckgo.com" }, "manageFilters": { "message": "Filter" @@ -1394,9 +1394,6 @@ "usercssReplaceTemplateConfirmation": { "message": "Ersetze das vorgegebene Template für neue UserCSS styles mit dem vorliegenden Code?" }, - "usercssReplaceTemplateName": { - "message": "Ein leeres @name ersetzt das vorgegebene Template" - }, "usercssReplaceTemplateSectionBody": { "message": "Quelltext hier eingeben..." }, diff --git a/_locales/el/messages.json b/_locales/el/messages.json index c6f9b9fa..90539340 100644 --- a/_locales/el/messages.json +++ b/_locales/el/messages.json @@ -413,7 +413,7 @@ "message": "Για αναίρεση μιας κατά λάθος επαναφοράς, πατήστε Ctrl-Z (ή Cmd-Z) στο πλαίσιο κειμένου" }, "manageFaviconsHelp": { - "message": "Το Stylus χρησιμοποιεί μία εξωτερική υπηρεσία https://www.google.com/s2/favicons" + "message": "Το Stylus χρησιμοποιεί μία εξωτερική υπηρεσία https://icons.duckduckgo.com" }, "manageFilters": { "message": "Φίλτρα" diff --git a/_locales/en/messages.json b/_locales/en/messages.json index 2e28bc2d..cda0cd07 100644 --- a/_locales/en/messages.json +++ b/_locales/en/messages.json @@ -760,7 +760,7 @@ "description": "Label for the checkbox that toggles grayed out mode of applies-to favicons in the new UI on manage page" }, "manageFaviconsHelp": { - "message": "Stylus uses an external service https://www.google.com/s2/favicons", + "message": "Stylus uses an external service https://icons.duckduckgo.com", "description": "Label for the checkbox that toggles applies-to favicons in the new UI on manage page" }, "manageFilters": { diff --git a/_locales/es/messages.json b/_locales/es/messages.json index 05fa33e5..6a941ef5 100644 --- a/_locales/es/messages.json +++ b/_locales/es/messages.json @@ -523,7 +523,7 @@ "message": "Atenuado" }, "manageFaviconsHelp": { - "message": "Stylus usa un servicio externo https://www.google.com/s2/favicons" + "message": "Stylus usa un servicio externo https://icons.duckduckgo.com" }, "manageFilters": { "message": "Filtros" @@ -1355,9 +1355,6 @@ "usercssReplaceTemplateConfirmation": { "message": "¿Reemplazar con el código actual la plantilla predeterminada para nuevos estilos UserCSS?" }, - "usercssReplaceTemplateName": { - "message": "@name vacío reemplaza la plantilla predeterminada" - }, "usercssReplaceTemplateSectionBody": { "message": "Inserte el código aquí..." }, diff --git a/_locales/et/messages.json b/_locales/et/messages.json index 87c4da66..78dcf456 100644 --- a/_locales/et/messages.json +++ b/_locales/et/messages.json @@ -494,7 +494,7 @@ "message": "Tee halliks" }, "manageFaviconsHelp": { - "message": "Stylus kasutab välist teenust https://www.google.com/s2/favicons" + "message": "Stylus kasutab välist teenust https://icons.duckduckgo.com" }, "manageFilters": { "message": "Filtrid" @@ -1112,9 +1112,6 @@ "usercssReplaceTemplateConfirmation": { "message": "Asendad vaikimisi malli uutes kasutajacss stiilides praeguse koodiga?" }, - "usercssReplaceTemplateName": { - "message": "Tühi @name asendab vaikimisi malli" - }, "usercssReplaceTemplateSectionBody": { "message": "Sisesta kood siia..." }, diff --git a/_locales/fr/messages.json b/_locales/fr/messages.json index 63afab78..58d05546 100644 --- a/_locales/fr/messages.json +++ b/_locales/fr/messages.json @@ -537,7 +537,7 @@ "message": "Grisés" }, "manageFaviconsHelp": { - "message": "Stylus utilise le service externe https://www.google.com/s2/favicons" + "message": "Stylus utilise le service externe https://icons.duckduckgo.com" }, "manageFilters": { "message": "Filtres" @@ -1339,9 +1339,6 @@ "usercssReplaceTemplateConfirmation": { "message": "Remplacer le modèle par défaut pour les nouveaux styles Usercss par le code actuel ?" }, - "usercssReplaceTemplateName": { - "message": "Un @name vide remplace le modèle par défaut" - }, "usercssReplaceTemplateSectionBody": { "message": "Insérer le code ici..." }, diff --git a/_locales/he/messages.json b/_locales/he/messages.json index 78b5b973..6451132d 100644 --- a/_locales/he/messages.json +++ b/_locales/he/messages.json @@ -494,7 +494,7 @@ "message": "האפרת האייקונים" }, "manageFaviconsHelp": { - "message": "Stylus משתמש בשירות חיצוני https://www.google.com/s2/favicons" + "message": "Stylus משתמש בשירות חיצוני https://icons.duckduckgo.com" }, "manageFilters": { "message": "מסננים" diff --git a/_locales/hu/messages.json b/_locales/hu/messages.json index 4798c273..216ce7f3 100644 --- a/_locales/hu/messages.json +++ b/_locales/hu/messages.json @@ -485,7 +485,7 @@ "message": "Megjelenítés szürkítve" }, "manageFaviconsHelp": { - "message": "A Stylus külső szolgáltatást használ (https://www.google.com/s2/favicons)" + "message": "A Stylus külső szolgáltatást használ (https://icons.duckduckgo.com)" }, "manageFilters": { "message": "Szűrők" @@ -1207,9 +1207,6 @@ "usercssReplaceTemplateConfirmation": { "message": "Le legyen cserélve az alapértelmezett sablon az új Usercss stílusokhoz a jelenlegi kóddal?" }, - "usercssReplaceTemplateName": { - "message": "Az üres @name lecseréli az alapértelmezett sablont" - }, "usercssReplaceTemplateSectionBody": { "message": "Írj kódot ide…" }, diff --git a/_locales/it/messages.json b/_locales/it/messages.json index 0c32c388..6e0d24cd 100644 --- a/_locales/it/messages.json +++ b/_locales/it/messages.json @@ -397,7 +397,7 @@ "message": "Ricaricamento live" }, "manageFaviconsHelp": { - "message": "Stylus utilizza un servizio esterno https://www.google.com/s2/favicons" + "message": "Stylus utilizza un servizio esterno https://icons.duckduckgo.com" }, "manageFilters": { "message": "Filtri" diff --git a/_locales/ja/messages.json b/_locales/ja/messages.json index feb014dd..50e4a35b 100644 --- a/_locales/ja/messages.json +++ b/_locales/ja/messages.json @@ -545,7 +545,7 @@ "message": "ファビコンをグレー表示" }, "manageFaviconsHelp": { - "message": "Stylusは外部サービスを使用します https://www.google.com/s2/favicons" + "message": "Stylusは外部サービスを使用します https://icons.duckduckgo.com" }, "manageFilters": { "message": "フィルター" @@ -1427,9 +1427,6 @@ "usercssReplaceTemplateConfirmation": { "message": "現在のコードで、新しいUsercssスタイルのデフォルト・テンプレートを置き換えますか?" }, - "usercssReplaceTemplateName": { - "message": "@name が指定されていません" - }, "usercssReplaceTemplateSectionBody": { "message": "ここにコードを挿入..." }, diff --git a/_locales/ko/messages.json b/_locales/ko/messages.json index c40ec262..5d264cfe 100644 --- a/_locales/ko/messages.json +++ b/_locales/ko/messages.json @@ -530,7 +530,7 @@ "message": "회색으로 표시" }, "manageFaviconsHelp": { - "message": "Stylus는 https://www.google.com/s2/favicons 외부 서비스를 이용합니다" + "message": "Stylus는 https://icons.duckduckgo.com 외부 서비스를 이용합니다" }, "manageFilters": { "message": "필터" @@ -1359,9 +1359,6 @@ "usercssReplaceTemplateConfirmation": { "message": "현재 코드로 새 Usercss 스타일의 기본 템플릿을 대체하시겠습니까?" }, - "usercssReplaceTemplateName": { - "message": "@name을 비우면 기본 템플릿이 대체됩니다." - }, "usercssReplaceTemplateSectionBody": { "message": "코드를 여기 입력하세요" }, diff --git a/_locales/nl/messages.json b/_locales/nl/messages.json index 13e2e65b..fc7bb3fb 100644 --- a/_locales/nl/messages.json +++ b/_locales/nl/messages.json @@ -555,7 +555,7 @@ "message": "Niet beschikbaar" }, "manageFaviconsHelp": { - "message": "Stylus gebruikt een externe dienst: https://www.google.com/s2/favicons" + "message": "Stylus gebruikt een externe dienst: https://icons.duckduckgo.com" }, "manageHeading": { "message": "Geïnstalleerde stijlen" @@ -1431,9 +1431,6 @@ "usercssReplaceTemplateConfirmation": { "message": "Wilt u de standaardsjabloon voor nieuwe Usercss-stijlen vervangen door de huidige code?" }, - "usercssReplaceTemplateName": { - "message": "Lege @name vervangt de standaardsjabloon" - }, "usercssReplaceTemplateSectionBody": { "message": "Voer hier code in..." }, diff --git a/_locales/pl/messages.json b/_locales/pl/messages.json index 78735383..ecea0086 100644 --- a/_locales/pl/messages.json +++ b/_locales/pl/messages.json @@ -580,7 +580,7 @@ "message": "Wyszarzone" }, "manageFaviconsHelp": { - "message": "Stylus korzysta z usługi zewnętrznej https://www.google.com/s2/favicons" + "message": "Stylus korzysta z usługi zewnętrznej https://icons.duckduckgo.com" }, "manageFilters": { "message": "Filtry" @@ -1468,9 +1468,6 @@ "usercssReplaceTemplateConfirmation": { "message": "Zastąpić domyślny szablon dla nowych stylów Usercss aktualnym kodem?" }, - "usercssReplaceTemplateName": { - "message": "Puste @name zastępuje szablon domyślny" - }, "usercssReplaceTemplateSectionBody": { "message": "Wstaw kod tutaj..." }, diff --git a/_locales/pt_BR/messages.json b/_locales/pt_BR/messages.json index 5645cb60..862e615e 100644 --- a/_locales/pt_BR/messages.json +++ b/_locales/pt_BR/messages.json @@ -805,9 +805,6 @@ "usercssReplaceTemplateConfirmation": { "message": "Substituir o template padrão por novos estilos com UserCSS com o código atual?" }, - "usercssReplaceTemplateName": { - "message": "@nome vazio substitui o template padrão" - }, "usercssReplaceTemplateSectionBody": { "message": "Insira o código aqui..." }, diff --git a/_locales/pt_PT/messages.json b/_locales/pt_PT/messages.json index 46b9c496..57edd712 100644 --- a/_locales/pt_PT/messages.json +++ b/_locales/pt_PT/messages.json @@ -449,7 +449,7 @@ "message": "Acinzentado(s)" }, "manageFaviconsHelp": { - "message": "O Stylus usa um serviço externo https://www.google.com/s2/favicons" + "message": "O Stylus usa um serviço externo https://icons.duckduckgo.com" }, "manageFilters": { "message": "Filtros" @@ -902,9 +902,6 @@ "usercssReplaceTemplateConfirmation": { "message": "Substituir o modelo predefinido para novos estilos de Usercss com o código atual?" }, - "usercssReplaceTemplateName": { - "message": "@name vazio substitui o modelo predefinido" - }, "usercssReplaceTemplateSectionBody": { "message": "Insira o código aqui..." }, diff --git a/_locales/ro/messages.json b/_locales/ro/messages.json index f5b899ef..92358488 100644 --- a/_locales/ro/messages.json +++ b/_locales/ro/messages.json @@ -410,7 +410,7 @@ "message": "Hașurat" }, "manageFaviconsHelp": { - "message": "Stylus folosește un serviciu extern https://www.google.com/s2/favicons" + "message": "Stylus folosește un serviciu extern https://icons.duckduckgo.com" }, "manageFilters": { "message": "Filtre" @@ -839,9 +839,6 @@ "usercssReplaceTemplateConfirmation": { "message": "Înlocuiți tema de bază a formatului Usercss cu acest cod?" }, - "usercssReplaceTemplateName": { - "message": "@name este gol și înlocuiețte valoarea de bază" - }, "usercssReplaceTemplateSectionBody": { "message": "Introduce cod aici..." }, diff --git a/_locales/ru/messages.json b/_locales/ru/messages.json index 0eb9edc1..ca50203e 100644 --- a/_locales/ru/messages.json +++ b/_locales/ru/messages.json @@ -583,7 +583,7 @@ "message": "Обесцвечивать" }, "manageFaviconsHelp": { - "message": "Используется сторонний сервис https://www.google.com/s2/favicons" + "message": "Используется сторонний сервис https://icons.duckduckgo.com" }, "manageFilters": { "message": "Фильтры" @@ -1471,9 +1471,6 @@ "usercssReplaceTemplateConfirmation": { "message": "Заменить шаблон по умолчанию для нового стиля в формате Usercss текущим кодом?" }, - "usercssReplaceTemplateName": { - "message": "Пустой @name заменяет шаблон по умолчанию" - }, "usercssReplaceTemplateSectionBody": { "message": "Место для CSS кода..." }, diff --git a/_locales/sv/messages.json b/_locales/sv/messages.json index ee4cb608..6e182118 100644 --- a/_locales/sv/messages.json +++ b/_locales/sv/messages.json @@ -479,7 +479,7 @@ "message": "Nedtonade" }, "manageFaviconsHelp": { - "message": "Stylus använder en extern tjänst https://www.google.com/s2/favicons" + "message": "Stylus använder en extern tjänst https://icons.duckduckgo.com" }, "manageFilters": { "message": "Filter" @@ -1191,9 +1191,6 @@ "usercssReplaceTemplateConfirmation": { "message": "Ersätt standardmallen för nya Usercss-stilar med den aktuella koden?" }, - "usercssReplaceTemplateName": { - "message": "Tom @name ersätter standardmallen" - }, "usercssReplaceTemplateSectionBody": { "message": "Lägg in kod här..." }, diff --git a/_locales/tr/messages.json b/_locales/tr/messages.json index 7bea31c1..b34be6bf 100644 --- a/_locales/tr/messages.json +++ b/_locales/tr/messages.json @@ -423,7 +423,7 @@ "message": "Gri renkte" }, "manageFaviconsHelp": { - "message": "Stylus harici bir servis kullanır https://www.google.com/s2/favicons" + "message": "Stylus harici bir servis kullanır https://icons.duckduckgo.com" }, "manageFilters": { "message": "Filtreler" @@ -779,9 +779,6 @@ "usercssReplaceTemplateConfirmation": { "message": "Yeni Usercss stilleri için varsayılan şablonu geçerli kodla değiştir?" }, - "usercssReplaceTemplateName": { - "message": "Boş @name, varsayılan şablonun yerini alır" - }, "usercssReplaceTemplateSectionBody": { "message": "Kodu buraya ekle..." }, diff --git a/_locales/zh/messages.json b/_locales/zh/messages.json index 20671a98..47681f62 100644 --- a/_locales/zh/messages.json +++ b/_locales/zh/messages.json @@ -553,7 +553,7 @@ "message": "显示为灰色图标" }, "manageFaviconsHelp": { - "message": "Stylus 使用外部服务 https://www.google.com/s2/favicons 来获取图标" + "message": "Stylus 使用外部服务 https://icons.duckduckgo.com 来获取图标" }, "manageFilters": { "message": "过滤器" @@ -1335,9 +1335,6 @@ "usercssReplaceTemplateConfirmation": { "message": "使用当前的 UserStyle 替换为新的UserCSS默认模板 ??" }, - "usercssReplaceTemplateName": { - "message": "该赋值为空的保存可设置默认模板" - }, "usercssReplaceTemplateSectionBody": { "message": "在此插入代码..." }, diff --git a/_locales/zh_CN/messages.json b/_locales/zh_CN/messages.json index 9fe11298..a30ed715 100644 --- a/_locales/zh_CN/messages.json +++ b/_locales/zh_CN/messages.json @@ -580,7 +580,7 @@ "message": "显示为灰色图标" }, "manageFaviconsHelp": { - "message": "Stylus 使用外部服务 https://www.google.com/s2/favicons 来获取图标" + "message": "Stylus 使用外部服务 https://icons.duckduckgo.com 来获取图标" }, "manageFilters": { "message": "过滤器" @@ -1465,9 +1465,6 @@ "usercssReplaceTemplateConfirmation": { "message": "使用当前 UserStyle 代码替换为新的默认模板吗 ?" }, - "usercssReplaceTemplateName": { - "message": "@name 为空值 可设置新的默认模板" - }, "usercssReplaceTemplateSectionBody": { "message": "在此插入代码..." }, diff --git a/_locales/zh_TW/messages.json b/_locales/zh_TW/messages.json index 4829597d..ec04e389 100644 --- a/_locales/zh_TW/messages.json +++ b/_locales/zh_TW/messages.json @@ -580,7 +580,7 @@ "message": "灰階淡出" }, "manageFaviconsHelp": { - "message": "Stylus 使用外部服務 https://www.google.com/s2/favicons" + "message": "Stylus 使用外部服務 https://icons.duckduckgo.com" }, "manageFilters": { "message": "過濾器" @@ -1465,9 +1465,6 @@ "usercssReplaceTemplateConfirmation": { "message": "為新的 Usercss 樣式取代預設的範本為目前的程式碼?" }, - "usercssReplaceTemplateName": { - "message": "清空 @name 取代目前範本" - }, "usercssReplaceTemplateSectionBody": { "message": "在此插入程式碼……" }, diff --git a/edit/regexp-tester.js b/edit/regexp-tester.js index bc940758..1c9850c7 100644 --- a/edit/regexp-tester.js +++ b/edit/regexp-tester.js @@ -5,7 +5,6 @@ 'use strict'; const regexpTester = (() => { - const GET_FAVICON_URL = 'https://www.google.com/s2/favicons?domain='; const OWN_ICON = chrome.runtime.getManifest().icons['16']; const cachedRegexps = new Map(); let currentRegexps = []; @@ -93,7 +92,7 @@ const regexpTester = (() => { for (const [url, match] of urls.entries()) { const faviconUrl = url.startsWith(URLS.ownOrigin) ? OWN_ICON - : GET_FAVICON_URL + new URL(url).hostname; + : URLS.favicon(new URL(url).hostname); const icon = $create('img', {src: faviconUrl}); if (match.text.length === url.length) { full.push($create('a', {tabIndex: 0}, [ diff --git a/js/toolbox.js b/js/toolbox.js index 2b33dd27..55bf3f46 100644 --- a/js/toolbox.js +++ b/js/toolbox.js @@ -71,6 +71,8 @@ const URLS = { 'about:newtab', ], + favicon: host => `https://icons.duckduckgo.com/ip3/${host}.ico`, + // Chrome 61.0.3161+ doesn't run content scripts on NTP https://crrev.com/2978953002/ // TODO: remove when "minimum_chrome_version": "61" or higher chromeProtectsNTP: CHROME >= 61, diff --git a/manage/render.js b/manage/render.js index 1ee013bd..6fd9cb6b 100644 --- a/manage/render.js +++ b/manage/render.js @@ -10,7 +10,6 @@ const ENTRY_ID_PREFIX_RAW = 'style-'; const TARGET_TYPES = ['domains', 'urls', 'urlPrefixes', 'regexps']; -const GET_FAVICON_URL = 'https://www.google.com/s2/favicons?domain='; const OWN_ICON = chrome.runtime.getManifest().icons['16']; const AGES = [ [24, 'h', t('dateAbbrHour', '\x01')], @@ -203,7 +202,7 @@ function getFaviconSrc(container = installed) { if (!targetValue) continue; let favicon = ''; if (type === 'domains') { - favicon = GET_FAVICON_URL + targetValue; + favicon = URLS.favicon(targetValue); } else if (targetValue.includes('chrome-extension:') || targetValue.includes('moz-extension:')) { favicon = OWN_ICON; } else if (type === 'regexps') { @@ -211,10 +210,10 @@ function getFaviconSrc(container = installed) { .replace(regexpRemoveNegativeLookAhead, '') .replace(regexpReplaceExtraCharacters, '') .match(regexpMatchRegExp); - favicon = favicon ? GET_FAVICON_URL + favicon.shift() : ''; + favicon = favicon ? URLS.favicon(favicon.shift()) : ''; } else { favicon = targetValue.includes('://') && targetValue.match(regexpMatchDomain); - favicon = favicon ? GET_FAVICON_URL + favicon[1] : ''; + favicon = favicon ? URLS.favicon(favicon[1]) : ''; } if (favicon) { const img = target.children[0];