From 136b0ecae10720d2970b64c22b98b582d1f2961e Mon Sep 17 00:00:00 2001 From: Ad5001 Date: Wed, 8 Nov 2023 17:11:59 +0100 Subject: [PATCH] [URGENT] Fixing unchecking --- test/frame.html | 86 +++++++++++++++++++++++++++++++++++++++++++++++++ uncheck.js | 11 +++---- 2 files changed, 90 insertions(+), 7 deletions(-) create mode 100644 test/frame.html diff --git a/test/frame.html b/test/frame.html new file mode 100644 index 0000000..b7e90f2 --- /dev/null +++ b/test/frame.html @@ -0,0 +1,86 @@ + + + + + + Unchecker tests in iframe + + + + +
+ Example radio list + + +
+ + +
+
+
+
+ Third party partners example + + +
+ + +
+ + +
+ + +
+
+
+
+ Third party partners second + + + + + + + + + + + + + + + + + + + + + + +
Google Analytics
Facebook Partnering
Amazon
Salesforce
+
+ + + diff --git a/uncheck.js b/uncheck.js index 384953f..908349d 100644 --- a/uncheck.js +++ b/uncheck.js @@ -7,16 +7,14 @@ * obtain one at http://mozilla.org/MPL/2.0/. **/ -const CHECKBOX_QUERY = 'input[type="checkbox"]' - const uncheckAll = () => { - document.body.querySelectorAll(CHECKBOX_QUERY).forEach(function(el){ + document.body.querySelectorAll('input[type="checkbox"]').forEach(function(el){ el.checked = false }) } const checkAll = () => { - document.body.querySelectorAll(CHECKBOX_QUERY).forEach(function(el){ + document.body.querySelectorAll('input[type="checkbox"]').forEach(function(el){ el.checked = true }) } @@ -32,15 +30,14 @@ const MENU_CONTEXTS = ["all"] function toggleScript(tab) { function gotTitle(title) { - console.log(title === TITLE_UNCHECK ? "Unchecking all checkboxes..." : "Checking all checkboxes...") + console.log((title === TITLE_UNCHECK ? "Unchecking all checkboxes..." : "Checking all checkboxes...") + " at tab " + tab.id) if(title === TITLE_UNCHECK) { browser.action.setIcon({tabId: tab.id, path: "icons/off.svg"}) browser.action.setTitle({tabId: tab.id, title: TITLE_CHECK}) browser.scripting.executeScript({ func: uncheckAll, target: { - tabId: tab.id, - allFrames: true, + tabId: tab.id } }) if(browser.menus)