From 5bb01b6cc833c3e3609a0992d2512137748c8e89 Mon Sep 17 00:00:00 2001 From: sameerasw Date: Wed, 5 Mar 2025 18:40:55 +0530 Subject: feature complete for #4 - forced theems for unthemed websites. --- background.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'background.js') diff --git a/background.js b/background.js index 472f42b..94baffa 100644 --- a/background.js +++ b/background.js @@ -1,3 +1,4 @@ +let SKIP_FORCE_THEMING_KEY = "skipForceThemingList"; let logging = false; async function applyCSSToTab(tab) { @@ -12,6 +13,11 @@ async function applyCSSToTab(tab) { if (globalSettings.enableStyling === false) return; const data = await browser.storage.local.get("styles"); + const skipListData = await browser.storage.local.get( + SKIP_FORCE_THEMING_KEY + ); + const skipList = skipListData[SKIP_FORCE_THEMING_KEY] || []; + const cssFileName = Object.keys(data.styles?.website || {}).find((key) => { const siteName = key.replace(".css", ""); @@ -20,7 +26,10 @@ async function applyCSSToTab(tab) { return hostname.endsWith(baseSiteName); } return hostname === siteName || hostname === `www.${siteName}`; - }) || (globalSettings.forceStyling ? "example.com.css" : null); + }) || + (globalSettings.forceStyling && !skipList.includes(hostname) + ? "example.com.css" + : null); if (!cssFileName) return; -- cgit v1.2.3