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 2e95ae94e167d4bec5edff5b09c5b076c5699d31 Mon Sep 17 00:00:00 2001 From: Vitaly Zdanevich Date: Thu, 7 Mar 2024 08:36:25 +0300 Subject: [PATCH 4/4] README.org: ico add --- README.org | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.org b/README.org index edd09eb..1df6ae6 100644 --- a/README.org +++ b/README.org @@ -1,4 +1,6 @@ * Engine Switcher +[[img/icon.png]] + A WebExtension to switch current page between various search engines in just one click (or =Ctrl+Alt+N=), if you are too lazy to type =!b=, =!g= (especially on mobile) in DuckDuckGo. So you can easily keep your privacy as possible as you can.