diff options
Diffstat (limited to 'public')
-rw-r--r-- | public/js/new.js | 32 | ||||
-rw-r--r-- | public/js/transfer.js | 20 |
2 files changed, 26 insertions, 26 deletions
diff --git a/public/js/new.js b/public/js/new.js index 62c2e4b..593258e 100644 --- a/public/js/new.js +++ b/public/js/new.js | |||
@@ -1,24 +1,24 @@ | |||
1 | /* eslint-env browser */ | 1 | /* eslint-env browser */ |
2 | const elDrop = document.querySelector('#dropzone'); | 2 | const elDrop = document.querySelector('#dropzone') |
3 | const submitBtn = document.querySelector('#submitbutton'); | 3 | const submitBtn = document.querySelector('#submitbutton') |
4 | const fileInput = document.querySelector('#files'); | 4 | const fileInput = document.querySelector('#files') |
5 | 5 | ||
6 | elDrop.addEventListener('dragover', event => { | 6 | elDrop.addEventListener('dragover', (event) => { |
7 | event.preventDefault(); | 7 | event.preventDefault() |
8 | }); | 8 | }) |
9 | 9 | ||
10 | elDrop.addEventListener('drop', async event => { | 10 | elDrop.addEventListener('drop', async (event) => { |
11 | event.preventDefault(); | 11 | event.preventDefault() |
12 | 12 | ||
13 | submitBtn.disabled = true; | 13 | submitBtn.disabled = true |
14 | 14 | ||
15 | fileInput.files = event.dataTransfer.files; | 15 | fileInput.files = event.dataTransfer.files |
16 | 16 | ||
17 | elDrop.textContent = `✓ ${fileInput.files.length} files selected`; | 17 | elDrop.textContent = `✓ ${fileInput.files.length} files selected` |
18 | elDrop.style.height = 'inherit'; | 18 | elDrop.style.height = 'inherit' |
19 | 19 | ||
20 | submitBtn.disabled = false; | 20 | submitBtn.disabled = false |
21 | }); | 21 | }) |
22 | elDrop.addEventListener('click', () => { | 22 | elDrop.addEventListener('click', () => { |
23 | fileInput.click(); | 23 | fileInput.click() |
24 | }); | 24 | }) |
diff --git a/public/js/transfer.js b/public/js/transfer.js index b4ba14c..4bf46fa 100644 --- a/public/js/transfer.js +++ b/public/js/transfer.js | |||
@@ -1,15 +1,15 @@ | |||
1 | /* eslint-env browser */ | 1 | /* eslint-env browser */ |
2 | const submitBtn = document.querySelector('#submit'); | 2 | const submitBtn = document.querySelector('#submit') |
3 | const fileInput = document.querySelector('#file'); | 3 | const fileInput = document.querySelector('#file') |
4 | const fileOutput = document.querySelector('#fileoutput'); | 4 | const fileOutput = document.querySelector('#fileoutput') |
5 | 5 | ||
6 | fileInput.addEventListener('change', () => { | 6 | fileInput.addEventListener('change', () => { |
7 | const reader = new FileReader(); | 7 | const reader = new FileReader() |
8 | reader.addEventListener('load', () => { | 8 | reader.addEventListener('load', () => { |
9 | const text = reader.result; | 9 | const text = reader.result |
10 | fileOutput.value = text; | 10 | fileOutput.value = text |
11 | submitBtn.disabled = false; | 11 | submitBtn.disabled = false |
12 | }); | 12 | }) |
13 | // eslint-disable-next-line unicorn/prefer-blob-reading-methods | 13 | // eslint-disable-next-line unicorn/prefer-blob-reading-methods |
14 | reader.readAsText(fileInput.files[0]); | 14 | reader.readAsText(fileInput.files[0]) |
15 | }); | 15 | }) |