diff options
| author | ilotterytea <iltsu@alright.party> | 2025-06-18 15:11:04 +0500 |
|---|---|---|
| committer | ilotterytea <iltsu@alright.party> | 2025-06-18 15:11:04 +0500 |
| commit | 70f40b94ad7f2d9eeb82a9313049e96d8fbc068d (patch) | |
| tree | fb17bb70450454a96cd242e6bff971b3bd49e7e6 | |
| parent | 312b5d6e873d53b78db4bef628fe01391a30cdb0 (diff) | |
feat: save upload options
| -rw-r--r-- | public/index.php | 1 | ||||
| -rw-r--r-- | public/static/scripts/options.js | 16 |
2 files changed, 17 insertions, 0 deletions
diff --git a/public/index.php b/public/index.php index b03b063..a6fa197 100644 --- a/public/index.php +++ b/public/index.php @@ -378,6 +378,7 @@ $privacy_exists = is_file($_SERVER['DOCUMENT_ROOT'] . '/static/PRIVACY.txt'); const formTabs = document.getElementById('form-upload-tabs'); </script> <script src="/static/scripts/audiorecorder.js"></script> + <script src="/static/scripts/options.js"></script> <script> document.querySelectorAll(".remove-script").forEach((x) => { x.remove(); diff --git a/public/static/scripts/options.js b/public/static/scripts/options.js new file mode 100644 index 0000000..7e4b4e4 --- /dev/null +++ b/public/static/scripts/options.js @@ -0,0 +1,16 @@ +let options = JSON.parse(localStorage.getItem('options') ?? '{}'); + +const checkboxes = document.querySelectorAll('input[type=checkbox]'); + +checkboxes.forEach((c) => { + const id = c.getAttribute('name'); + + c.addEventListener('change', () => { + options[id] = c.checked; + localStorage.setItem('options', JSON.stringify(options)); + }); + + if (options[id] !== undefined) { + c.checked = options[id]; + } +});
\ No newline at end of file |
