diff options
| author | ilotterytea <iltsu@alright.party> | 2025-07-26 18:32:11 +0500 |
|---|---|---|
| committer | ilotterytea <iltsu@alright.party> | 2025-07-26 18:32:11 +0500 |
| commit | 314a09f450988a3a07139c7f63c722e94cd2fe94 (patch) | |
| tree | c1a23231f62bc2de0559c5cea7e3c89bb90fc016 /public/static/scripts/form.js | |
| parent | a60c9f70d3a493d63c288a671f32db409c2da929 (diff) | |
feat: show upload progress
Diffstat (limited to 'public/static/scripts/form.js')
| -rw-r--r-- | public/static/scripts/form.js | 31 |
1 files changed, 28 insertions, 3 deletions
diff --git a/public/static/scripts/form.js b/public/static/scripts/form.js index 6e4f608..f2736c1 100644 --- a/public/static/scripts/form.js +++ b/public/static/scripts/form.js @@ -12,18 +12,43 @@ document.onpaste = () => { function showFile(file) { setFormDetailsVisiblity(file != null); - + if (file == null) { fileUploadWrapper.innerHTML = '<h1>Click, drop, or paste files here</h1>'; - + if (fileURLWrapper) { fileURLWrapper.style.display = 'flex'; } } else { fileUploadWrapper.innerHTML = `<h1>File: ${file.name}</h1>`; - + if (fileURLWrapper) { fileURLWrapper.style.display = 'none'; } } +} + +function setFormDetailsVisiblity(show) { + formDetails.style.display = show ? 'flex' : 'none'; + formSubmitButton.style.display = show ? 'block' : 'none'; +} + +function showUploadType(type) { + if (formTabs.hasAttribute('disabled')) { + return; + } + + document.getElementById('form-upload-wrapper').style.display = type == 'file' ? 'flex' : 'none'; + document.getElementById('form-text-upload').style.display = type == 'text' ? 'flex' : 'none'; + document.getElementById('form-record-upload').style.display = type === 'audio' ? 'flex' : 'none'; + + const tabs = document.querySelectorAll('.form-upload-tab'); + + for (const tab of tabs) { + if (tab.getAttribute('id') == `form-tab-${type}`) { + tab.classList.remove('disabled'); + } else { + tab.classList.add('disabled'); + } + } }
\ No newline at end of file |
