From 1cc24417e2f8a6420503735c10577f57c9b4e323 Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Wed, 8 Sep 2021 00:09:59 +0200 Subject: 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` --- background.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'background.js') 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' } + ); + }); } }); }); -- cgit v1.2.3