-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.js
23 lines (21 loc) · 847 Bytes
/
script.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
document.addEventListener('DOMContentLoaded', () => {
const toggle = document.getElementById('randomize-toggle');
if (toggle) {
chrome.storage.sync.get(['randomizeEnabled'], (result) => {
if (chrome.runtime.lastError) {
console.error('Error loading storage:', chrome.runtime.lastError);
return;
}
toggle.checked = result.randomizeEnabled || false;
});
toggle.addEventListener('change', () => {
chrome.storage.sync.set({ randomizeEnabled: toggle.checked }, () => {
if (chrome.runtime.lastError) {
console.error('Error saving state:', chrome.runtime.lastError);
}
});
});
} else {
console.warn('Randomize toggle not found in the DOM.');
}
});