Compare commits

...

3 commits
v1.2 ... master

Author SHA1 Message Date
Ad5001 683749748b
Forgot to re-add frames checking support. 2023-11-08 17:24:21 +01:00
Ad5001 d470131bde
Bumping version 2023-11-08 17:18:01 +01:00
Ad5001 136b0ecae1
[URGENT] Fixing unchecking 2023-11-08 17:11:59 +01:00
3 changed files with 91 additions and 7 deletions

View file

@ -3,7 +3,7 @@
"description": "Simple extension letting you uncheck all checkboxes on a page.",
"manifest_version": 3,
"name": "unchecker",
"version": "1.2",
"version": "1.2.2",
"author": "Ad5001",
"developer": {
"name": "Ad5001",

86
test/frame.html Normal file
View file

@ -0,0 +1,86 @@
<!--
* Unchecker - Simple extension letting you uncheck all checkboxes on a page
* Copyright (c) Ad5001 2021-2023
*
* This Source Code Form is subject to the terms of the Mozilla Public License,
* v. 2.0. If a copy of the MPL was not distributed with this file, You can
* obtain one at http://mozilla.org/MPL/2.0/.
-->
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Unchecker tests in iframe</title>
<style>
legend {
background-color: #000;
color: #fff;
padding: 3px 6px;
}
.toggled {
border-color: blue;
}
input {
margin: .4rem;
}
</style>
<script src="test.js"></script>
</head>
<body>
<fieldset>
<legend>Example radio list</legend>
<input type="radio" id="choice-value1" name="choice-value">
<label for="choice-value">Example, irrelevant choice value 1</label><br/>
<input type="radio" id="choice-value2" name="choice-value">
<label for="choice-value">Example, irrelevant choice value 2</label><br/>
</fieldset>
<br>
<fieldset>
<legend>Third party partners example</legend>
<input type="checkbox" id="ga-choice" checked="true">
<label for="ga-choice">Google Analytics</label><br/>
<input type="checkbox" id="facebook-ads" checked="true">
<label for="facebook-ads">Facebook Partnering</label><br/>
<input type="checkbox" id="amazon-sales" checked="true">
<label for="amazon-sales">Amazon</label><br/>
<input type="checkbox" id="salesforce" checked="true">
<label for="salesforce">Salesforce</label><br/>
</fieldset>
<br>
<fieldset>
<legend>Third party partners second</legend>
<table>
<tr>
<td>Google Analytics</td>
<td><button role="toggle" class="toggled" name="ga-choice">On</button></td>
<td><button role="toggle" name="ga-choice">Off</button></td>
</tr>
<tr>
<td>Facebook Partnering</td>
<td><button role="toggle" class="toggled" name="facebook-ads">On</button></td>
<td><button role="toggle" name="facebook-ads">Off</button></td>
</tr>
<tr>
<td>Amazon</td>
<td><button role="toggle" class="toggled" name="amazon-sales">On</button></td>
<td><button role="toggle" name="amazon-sales">Off</button></td>
</tr>
<tr>
<td>Salesforce</td>
<td><button role="toggle" class="toggled" name="salesforce">On</button></td>
<td><button role="toggle" name="salesforce">Off</button></td>
</tr>
</table>
</fieldset>
</body>
</html>

View file

@ -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,7 +30,7 @@ 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})
@ -40,7 +38,7 @@ function toggleScript(tab) {
func: uncheckAll,
target: {
tabId: tab.id,
allFrames: true,
allFrames: true
}
})
if(browser.menus)