diff options
| author | ilotterytea <iltsu@alright.party> | 2025-06-18 15:46:29 +0500 |
|---|---|---|
| committer | ilotterytea <iltsu@alright.party> | 2025-06-18 15:46:29 +0500 |
| commit | 5ccc4a0fce0548697e5e57253f977d2d14a6cbea (patch) | |
| tree | fe74e1d0a20c88f8568be7458d36ca1ee1f2f32a /public/static/scripts/options.js | |
| parent | aeff80740333ec49d13638f36b2bc74bc820404c (diff) | |
feat: file expiration
Diffstat (limited to 'public/static/scripts/options.js')
| -rw-r--r-- | public/static/scripts/options.js | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/public/static/scripts/options.js b/public/static/scripts/options.js index 7e4b4e4..e460f29 100644 --- a/public/static/scripts/options.js +++ b/public/static/scripts/options.js @@ -1,8 +1,6 @@ let options = JSON.parse(localStorage.getItem('options') ?? '{}'); -const checkboxes = document.querySelectorAll('input[type=checkbox]'); - -checkboxes.forEach((c) => { +document.querySelectorAll('input[type=checkbox]').forEach((c) => { const id = c.getAttribute('name'); c.addEventListener('change', () => { @@ -13,4 +11,17 @@ checkboxes.forEach((c) => { if (options[id] !== undefined) { c.checked = options[id]; } +}); + +document.querySelectorAll('select').forEach((c) => { + const id = c.getAttribute('name'); + + c.addEventListener('change', () => { + options[id] = c.value; + localStorage.setItem('options', JSON.stringify(options)); + }); + + if (options[id] !== undefined) { + c.value = options[id]; + } });
\ No newline at end of file |
