diff options
author | sameerasw <[email protected]> | 2025-03-05 17:55:45 +0530 |
---|---|---|
committer | sameerasw <[email protected]> | 2025-03-05 17:55:45 +0530 |
commit | bbeae845b702727f0ffaf3e49c85ed9bc0f971ab (patch) | |
tree | 67552b6f6fd88568862fdf61dc6bb50060f60fc6 /background.js | |
parent | 34e74fda832756db278b43fa9b0e0cfb99430f8a (diff) |
Wildcards for forcing theme on unthemed websites
Diffstat (limited to 'background.js')
-rw-r--r-- | background.js | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/background.js b/background.js index affef80..472f42b 100644 --- a/background.js +++ b/background.js @@ -12,14 +12,15 @@ async function applyCSSToTab(tab) { if (globalSettings.enableStyling === false) return; const data = await browser.storage.local.get("styles"); - const cssFileName = Object.keys(data.styles?.website || {}).find((key) => { - const siteName = key.replace(".css", ""); - if (siteName.startsWith("+")) { - const baseSiteName = siteName.slice(1); - return hostname.endsWith(baseSiteName); - } - return hostname === siteName || hostname === `www.${siteName}`; - }); + const cssFileName = + Object.keys(data.styles?.website || {}).find((key) => { + const siteName = key.replace(".css", ""); + if (siteName.startsWith("+")) { + const baseSiteName = siteName.slice(1); + return hostname.endsWith(baseSiteName); + } + return hostname === siteName || hostname === `www.${siteName}`; + }) || (globalSettings.forceStyling ? "example.com.css" : null); if (!cssFileName) return; |