diff options
Diffstat (limited to 'content/noscript.js')
-rw-r--r-- | content/noscript.js | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/content/noscript.js b/content/noscript.js index 9ea2f08..9cf1ac1 100644 --- a/content/noscript.js +++ b/content/noscript.js @@ -20,16 +20,20 @@ */ "use strict"; { - browser.runtime.onMessage.addListener(async m => { + const showNoScript = () => { + for (const noscript of document.querySelectorAll( + 'noscript:not([data-librejs-nodisplay])')) { + const replacement = document.createElement('span'); + replacement.innerHTML = noscript.innerHTML; + noscript.replaceWith(replacement); + } + }; + + browser.runtime.onMessage.addListener(m => { if (m.action === 'forceNoscript') { try { - debug("Received message", m); - for (const noscript of document.querySelectorAll( - 'noscript:not([data-librejs-nodisplay])')) { - const replacement = document.createElement('span'); - replacement.innerHTML = noscript.innerHTML; - noscript.replaceWith(replacement); - } + console.log("Received message", m); + showNoScript(); } catch (e) { console.error(e); } |