-
Notifications
You must be signed in to change notification settings - Fork 7
/
popup.js
33 lines (31 loc) · 1.32 KB
/
popup.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
document.addEventListener('DOMContentLoaded', function () {
let checkbox_redirectToOriginalImage = document.getElementById('redirectToOriginalImage');
let checkbox_useOldAccept = document.getElementById('useOldAccept');
let checkbox_disableLightbox = document.getElementById('disableLightbox');
// Get the current enabled setting from storage
browser.storage.local.get('redirectToOriginalImage').then((res) => {
checkbox_redirectToOriginalImage.checked = res.redirectToOriginalImage;
});
browser.storage.local.get('useOldAccept').then((res) => {
checkbox_useOldAccept.checked = res.useOldAccept;
});
browser.storage.local.get('disableLightbox').then((res) => {
checkbox_disableLightbox.checked = res.disableLightbox;
});
// Update the setting in storage when the checkbox is changed
checkbox_redirectToOriginalImage.addEventListener('change', function () {
browser.storage.local.set({
redirectToOriginalImage: checkbox_redirectToOriginalImage.checked,
});
});
checkbox_useOldAccept.addEventListener('change', function () {
browser.storage.local.set({
useOldAccept: checkbox_useOldAccept.checked,
});
});
checkbox_disableLightbox.addEventListener('change', function () {
browser.storage.local.set({
disableLightbox: checkbox_disableLightbox.checked,
});
});
});