| 89 | // ============================================================================ |
| 90 | |
| 91 | function setupCheckbox(inputId, storageKey, defaultValue = true) { |
| 92 | const input = document.getElementById(inputId); |
| 93 | if (!input) return; |
| 94 | |
| 95 | // Load saved value |
| 96 | chrome.storage.sync.get(storageKey, (data) => { |
| 97 | input.checked = data[storageKey] !== undefined ? data[storageKey] : defaultValue; |
| 98 | }); |
| 99 | |
| 100 | // Save on change |
| 101 | input.addEventListener('change', (e) => { |
| 102 | saveOption(storageKey, e.target.checked); |
| 103 | }); |
| 104 | } |
| 105 | |
| 106 | // ============================================================================ |
| 107 | // SELECT INPUTS |