-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpopup.js
More file actions
38 lines (34 loc) · 1.17 KB
/
popup.js
File metadata and controls
38 lines (34 loc) · 1.17 KB
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
34
35
36
37
38
document.addEventListener('DOMContentLoaded', function() {
const theme = document.getElementById('theme');
const autoFormat = document.getElementById('autoFormat');
const formatAllSites = document.getElementById('formatAllSites');
const showButtons = document.getElementById('showButtons');
// Load settings
loadSettings();
// Save settings when changed
theme.addEventListener('change', saveSettings);
autoFormat.addEventListener('change', saveSettings);
formatAllSites.addEventListener('change', saveSettings);
showButtons.addEventListener('change', saveSettings);
function loadSettings() {
browser.storage.sync.get({
theme: 'dark',
autoFormat: true,
formatAllSites: true,
showButtons: false
}).then(settings => {
theme.value = settings.theme;
autoFormat.checked = settings.autoFormat;
formatAllSites.checked = settings.formatAllSites;
showButtons.checked = settings.showButtons;
});
}
function saveSettings() {
browser.storage.sync.set({
theme: theme.value,
autoFormat: autoFormat.checked,
formatAllSites: formatAllSites.checked,
showButtons: showButtons.checked
});
}
});