From b8f577fe1568f74bae9e6b58edabd0ff7c26fcd2 Mon Sep 17 00:00:00 2001 From: sameerasw Date: Fri, 28 Feb 2025 22:58:22 +0530 Subject: Fixed #3 by allowing files starting with + to have prefixes in the url. --- background.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'background.js') 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; -- cgit v1.2.3