summaryrefslogtreecommitdiff
path: root/background.js
diff options
context:
space:
mode:
Diffstat (limited to 'background.js')
-rw-r--r--background.js17
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;