diff 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 |
