diff options
author | Yuchen Pei <hi@ypei.me> | 2022-10-13 11:50:15 +1100 |
---|---|---|
committer | Yuchen Pei <hi@ypei.me> | 2022-10-13 11:50:15 +1100 |
commit | 55c748d6a50af4e93b138bf73e37c71f946fab19 (patch) | |
tree | 8f78d7535e741cf51f15bac73de5c8de4c97cb4b /content/noscript.js | |
parent | b849b8d461479cf6530c77b97b094807840ce0d7 (diff) |
minor fix of noscript.js, and make it show up in console debugger
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); } |