diff options
Diffstat (limited to 'inject-css.js')
-rw-r--r-- | inject-css.js | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/inject-css.js b/inject-css.js index fc1fc0f..3246255 100644 --- a/inject-css.js +++ b/inject-css.js @@ -19,12 +19,14 @@ if (logging) console.log("inject-css.js script loaded"); const currentUrl = window.location.hostname; if (logging) console.log("Current URL hostname", currentUrl); - const cssFileName = Object.keys(data.styles?.website || {}).find( - (key) => { - const siteName = key.replace(".css", ""); - return currentUrl === siteName || currentUrl === `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 currentUrl.endsWith(baseSiteName); } - ); + return currentUrl === siteName || currentUrl === `www.${siteName}`; + }); if (!cssFileName) { if (logging) console.log("No CSS file found for current site"); |