remind the user to restart the browser when disabling icon show

This commit is contained in:
buzz-lightsnack-2007 2024-05-12 19:30:45 +08:00
parent 9ce1dfb6eb
commit 4f07cb5b5d
2 changed files with 20 additions and 4 deletions

View file

@ -189,6 +189,13 @@
"settings_filters_target": {
"message": "Injection Target"
},
"settings_restartToApply": {
"message": "Restart the extension or the browser to apply the changes."
},
"settings_restartToApply_iconChange": {
"message": "The icon change doesn't happen automatically."
},
"saving_current": {
"message": "Saving…"
},

View file

@ -86,10 +86,19 @@ class Page_Settings extends Page {
});
}
if (document.querySelector(`[data-action="storage,clear"]`)) {
document
.querySelector(`[data-action="storage,clear"]`)
.addEventListener(`click`, async () => {
// The extension icon cache doesn't clear by itself.
(document.querySelector(`[data-store="settings,general,showApplicable"]`))
? document.querySelectorAll(`[data-store="settings,general,showApplicable"]`).forEach((ELEMENT) => {
ELEMENT.addEventListener(`change`, () => {
!(ELEMENT.checked)
? new logging(texts.localized(`settings_restartToApply`), texts.localized(`settings_restartToApply_iconChange`), true)
: false;
})
})
: false;
(document.querySelector(`[data-action="storage,clear"]`))
? document.querySelector(`[data-action="storage,clear"]`).addEventListener(`click`, async () => {
await global.forget(`sites`);
console.log(await global.read(null, 1), await global.read(null, -1));
});