diff options
author | Teddy Wing | 2021-09-08 00:09:59 +0200 |
---|---|---|
committer | Teddy Wing | 2021-09-08 00:09:59 +0200 |
commit | 1cc24417e2f8a6420503735c10577f57c9b4e323 (patch) | |
tree | ba7b74e36cc1f7460c7f024d0d619fd473e1fcbf /background.js | |
parent | de5f4ccd88076be4e532b4d0137d8404d458dcd7 (diff) | |
download | Legibility-1cc24417e2f8a6420503735c10577f57c9b4e323.tar.bz2 |
background: Apply CSS from all files for wildcard domains
For the hostname "en.wikipedia.org", all of the following CSS files are
inserted:
* `*.css`
* `*.org.css`
* `*.wikipedia.org.css`
* `en.wikipedia.org.css`
Diffstat (limited to 'background.js')
-rw-r--r-- | background.js | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/background.js b/background.js index b187850..2b5dc1d 100644 --- a/background.js +++ b/background.js @@ -26,10 +26,13 @@ browser.runtime.onMessage.addListener(function(message) { var url = new URL(details.url); if (url.hostname === message.domain) { - browser.tabs.insertCSS( - details.tabId, - { file: '/css/' + message.domain + '.css' } - ); + wildcard_domains(message.domain) + .forEach(function(domain) { + browser.tabs.insertCSS( + details.tabId, + { file: '/css/' + domain + '.css' } + ); + }); } }); }); |