parent
244dfe7743
commit
34b0a90012
2 changed files with 10 additions and 0 deletions
|
|
@ -153,6 +153,11 @@ document.addEventListener('DOMContentLoaded', async () => {
|
||||||
document.querySelectorAll('.accountCheckbox').forEach(checkbox => {
|
document.querySelectorAll('.accountCheckbox').forEach(checkbox => {
|
||||||
checkbox.addEventListener('change', () => {
|
checkbox.addEventListener('change', () => {
|
||||||
let selectedAccounts = Array.from(document.querySelectorAll('.accountCheckbox:checked')).map(checkbox => checkbox.value);
|
let selectedAccounts = Array.from(document.querySelectorAll('.accountCheckbox:checked')).map(checkbox => checkbox.value);
|
||||||
|
if (selectedAccounts.length === 0) {
|
||||||
|
checkbox.checked = true; // Prevent deselecting the last selected checkbox
|
||||||
|
taLog.log("At least one account must be selected.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (selectedAccounts.length === document.querySelectorAll('.accountCheckbox').length) {
|
if (selectedAccounts.length === document.querySelectorAll('.accountCheckbox').length) {
|
||||||
browser.storage.sync.set({ add_tags_enabled_accounts: [] });
|
browser.storage.sync.set({ add_tags_enabled_accounts: [] });
|
||||||
taLog.log("All accounts selected, saving add_tags_enabled_accounts = [].");
|
taLog.log("All accounts selected, saving add_tags_enabled_accounts = [].");
|
||||||
|
|
|
||||||
|
|
@ -110,6 +110,11 @@ document.addEventListener('DOMContentLoaded', async () => {
|
||||||
document.querySelectorAll('.accountCheckbox').forEach(checkbox => {
|
document.querySelectorAll('.accountCheckbox').forEach(checkbox => {
|
||||||
checkbox.addEventListener('change', () => {
|
checkbox.addEventListener('change', () => {
|
||||||
let selectedAccounts = Array.from(document.querySelectorAll('.accountCheckbox:checked')).map(checkbox => checkbox.value);
|
let selectedAccounts = Array.from(document.querySelectorAll('.accountCheckbox:checked')).map(checkbox => checkbox.value);
|
||||||
|
if (selectedAccounts.length === 0) {
|
||||||
|
checkbox.checked = true; // Prevent deselecting the last selected checkbox
|
||||||
|
taLog.log("At least one account must be selected.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (selectedAccounts.length === document.querySelectorAll('.accountCheckbox').length) {
|
if (selectedAccounts.length === document.querySelectorAll('.accountCheckbox').length) {
|
||||||
browser.storage.sync.set({ spamfilter_enabled_accounts: [] });
|
browser.storage.sync.set({ spamfilter_enabled_accounts: [] });
|
||||||
taSpamReport.logger.log("All accounts selected, saving spamfilter_enabled_accounts = [].");
|
taSpamReport.logger.log("All accounts selected, saving spamfilter_enabled_accounts = [].");
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue