diff options
author | sameerasw <[email protected]> | 2025-02-28 22:58:22 +0530 |
---|---|---|
committer | sameerasw <[email protected]> | 2025-02-28 22:58:22 +0530 |
commit | b8f577fe1568f74bae9e6b58edabd0ff7c26fcd2 (patch) | |
tree | 158ec80ef789fba1b3967ba16d5edc12e22dd0dd /background.js | |
parent | 35f2ec8e814fd57629d3a7b4b784c71223e2cecd (diff) |
Fixed #3 by allowing files starting with + to have prefixes in the url.
Diffstat (limited to 'background.js')
-rw-r--r-- | background.js | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/background.js b/background.js index 126c295..affef80 100644 --- a/background.js +++ b/background.js @@ -12,12 +12,14 @@ 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", ""); - 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}`; + }); if (!cssFileName) return; |