Update popup.js

This commit is contained in:
Yumi Izumi 2020-11-08 23:58:22 +09:00 committed by GitHub
parent 612d359279
commit 1d4c61f4af
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 0 deletions

View File

@ -5,6 +5,7 @@ let disableInvidious = document.querySelector("#disable-invidious");
let disableBibliogram = document.querySelector("#disable-bibliogram");
let disableOsm = document.querySelector("#disable-osm");
let disableOldReddit = document.querySelector("#disable-old-reddit");
let disableSearchEngine = document.querySelector("#disable-searchEngine");
let version = document.querySelector("#version");
window.browser = window.browser || window.chrome;
@ -16,6 +17,7 @@ browser.storage.sync.get(
"disableBibliogram",
"disableOsm",
"disableOldReddit",
"disableSearchEngine",
"theme",
],
(result) => {
@ -25,6 +27,7 @@ browser.storage.sync.get(
disableBibliogram.checked = !result.disableBibliogram;
disableOsm.checked = !result.disableOsm;
disableOldReddit.checked = !result.disableOldReddit;
disableSearchEngine.checked = !result.disableSearchEngine;
}
);
@ -50,6 +53,10 @@ disableOldReddit.addEventListener("change", (event) => {
browser.storage.sync.set({ disableOldReddit: !event.target.checked });
});
disableSearchEngine.addEventListener("change", (event) => {
browser.storage.sync.set({ disableSearchEngine: !event.target.checked });
});
document.querySelector("#more-options").addEventListener("click", () => {
browser.runtime.openOptionsPage();
});