-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetting.js
More file actions
26 lines (24 loc) · 992 Bytes
/
setting.js
File metadata and controls
26 lines (24 loc) · 992 Bytes
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
document.addEventListener('DOMContentLoaded', () => {
const thresholdInput = document.getElementById('thresholdInput');
const enableSound = document.getElementById('enableSound');
const enableDark = document.getElementById('enableDark');
const saveBtn = document.getElementById('saveBtn');
const status = document.getElementById('status');
// Load saved settings
chrome.storage.local.get(['customThreshold', 'soundEnabled', 'darkMode'], (data) => {
thresholdInput.value = data.customThreshold || 10;
enableSound.checked = data.soundEnabled || false;
enableDark.checked = data.darkMode || false;
});
// Save on click
saveBtn.addEventListener('click', () => {
chrome.storage.local.set({
customThreshold: parseInt(thresholdInput.value),
soundEnabled: enableSound.checked,
darkMode: enableDark.checked
}, () => {
status.textContent = '✅ Settings saved!';
setTimeout(() => status.textContent = '', 2000);
});
});
});