From dabb9528c151b460a702ddc78ac363e081826610 Mon Sep 17 00:00:00 2001 From: Vitaly Zdanevich Date: Wed, 6 Mar 2024 13:30:53 +0300 Subject: [PATCH 1/4] refactor: [content.ts] Add dark mode support (CSS @media) PR #4 --- src/content.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/content.ts b/src/content.ts index 537f7df..e9b7d25 100644 --- a/src/content.ts +++ b/src/content.ts @@ -207,6 +207,20 @@ async function setupFloatBar() { body { padding-bottom: ${ICON_SIZE}px; } + + @media(prefers-color-scheme: dark) { + #engineSwitcherBar { + --bg: #000; + border-color: #333; + } + #engineSwitcherBar img[src$='wikipedia.svg']:not(:hover) { + filter: invert(100%); + } + #engineSwitcherBar a.active { + background: #222; + border-bottom: 3px solid #999; + } + } ` const floatEl = document.createElement('div') floatEl.id = 'engineSwitcherBar' From 5c6ab432e43b045f81858043f8aadf05857afb87 Mon Sep 17 00:00:00 2001 From: ono ono Date: Thu, 7 Mar 2024 12:46:30 +0800 Subject: [PATCH 2/4] refactor: [content.ts] Use CSS variable instead of duplicated rules. Unify the behavior between light and dark. Fix for PR #4 --- src/content.ts | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/content.ts b/src/content.ts index e9b7d25..b3f3d33 100644 --- a/src/content.ts +++ b/src/content.ts @@ -166,6 +166,8 @@ async function setupFloatBar() { #engineSwitcherBar { --bg: #ffffff; --bgActive: #eeeeee; + --bgHover: #eeeeee; + --activeIndicator: #5599ff; --fg: #333333; --bd: #cccccc; display: flex; @@ -196,6 +198,9 @@ async function setupFloatBar() { #engineSwitcherBar a:hover { background: var(--bgActive); } + #engineSwitcherBar .active { + border-bottom: 3px solid var(--activeIndicator); + } #engineSwitcherBar a .iconImg { width: ${ICON_SIZE}px; min-width: ${ICON_SIZE}px; @@ -211,15 +216,16 @@ async function setupFloatBar() { @media(prefers-color-scheme: dark) { #engineSwitcherBar { --bg: #000; - border-color: #333; + --bgActive: #333333; + --bgHover: #eeeeee; + --activeIndicator: #999999; + --fg: #666666; + --bd: #666666; } - #engineSwitcherBar img[src$='wikipedia.svg']:not(:hover) { + #engineSwitcherBar img[src$='wikipedia.svg'], + #engineSwitcherBar a.closeBtn svg { filter: invert(100%); } - #engineSwitcherBar a.active { - background: #222; - border-bottom: 3px solid #999; - } } ` const floatEl = document.createElement('div') From 5876d669f9933b34eaa062214f8d8fdb7e35d69a Mon Sep 17 00:00:00 2001 From: ono ono Date: Thu, 7 Mar 2024 13:03:05 +0800 Subject: [PATCH 3/4] feat: [common.ts] Update description of Wikipedia fix PR #9 --- src/common.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/common.ts b/src/common.ts index 5dc0d64..5a68fa5 100644 --- a/src/common.ts +++ b/src/common.ts @@ -374,18 +374,18 @@ export const ALL_ENGINES: SearchEngine[] = [ }, { id: 'enwiki', - name: 'English Wikipedia (Not recommended)', + name: '🧪 Wikipedia (English)', hostname: 'en.wikipedia.org', queryKey: 'search', queryUrl: 'https://en.wikipedia.org/w/index.php?search={}&title=Special:Search&fulltext=1&ns0=1', queryNeedContentScript: false, iconUrl: browser.runtime.getURL('img/engines/wikipedia.svg'), privacyInfo: { - collectData: CollectData.Yes, + collectData: CollectData.No, // https://foundation.wikimedia.org/wiki/Policy:Wikipedia_15_Privacy_Policy "Generally, we keep personal, nonpublic information about you confidential. We do not sell or rent your nonpublic information, nor do we give it to others to sell you anything. However, there are a few specific circumstances where we are permitted to share your information."" jurisdiction: '🇺🇸 United States', resultsSources: ['__own__'], since: 2001, - summary: "Not a general-purposed search engine though, but a user want this feature and send a PR." + summary: "(🧪 Experimental) Everyone knows what this is, but not recommended to use here because this is not a general-purposed search engine and may be not practical, but a user want this feature and sent a PR." }, }, ] From a69d903848b46ac6b5d06576ff809af5d68cc7ff Mon Sep 17 00:00:00 2001 From: Vitaly Zdanevich Date: Fri, 8 Mar 2024 07:31:13 +0300 Subject: [PATCH 4/4] manifest.json: clarify Wikipedia search page Against the problem that now we have the UI on every Wikipedia page. --- manifest.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.json b/manifest.json index aa72892..83d6dfc 100644 --- a/manifest.json +++ b/manifest.json @@ -41,7 +41,7 @@ "*://search.yahoo.com/*", "*://search.yahoo.co.jp/*", "*://search.goo.ne.jp/*", - "*://en.wikipedia.org/*" + "https://en.wikipedia.org/w/index.php?search=*" ], "js": ["dist/content.js"], "css": ["dist/content_tippy.css"]