Update static/script.js
Browse files- static/script.js +6 -5
static/script.js
CHANGED
@@ -10,6 +10,7 @@ document.addEventListener('DOMContentLoaded', () => {
|
|
10 |
const downloadLink = document.getElementById('downloadLink');
|
11 |
|
12 |
let isDecrypting = false;
|
|
|
13 |
|
14 |
['dragenter', 'dragover', 'dragleave', 'drop'].forEach(eventName => {
|
15 |
dropArea.addEventListener(eventName, preventDefaults, false);
|
@@ -50,10 +51,11 @@ document.addEventListener('DOMContentLoaded', () => {
|
|
50 |
|
51 |
function handleFiles(files) {
|
52 |
if (files.length > 0) {
|
53 |
-
|
54 |
-
isDecrypting =
|
55 |
options.style.display = 'block';
|
56 |
processButton.textContent = isDecrypting ? 'Deconvert' : 'Convert';
|
|
|
57 |
}
|
58 |
}
|
59 |
|
@@ -62,14 +64,13 @@ document.addEventListener('DOMContentLoaded', () => {
|
|
62 |
});
|
63 |
|
64 |
processButton.addEventListener('click', function() {
|
65 |
-
|
66 |
-
if (!file) {
|
67 |
alert('Please select a file first.');
|
68 |
return;
|
69 |
}
|
70 |
|
71 |
const formData = new FormData();
|
72 |
-
formData.append('file',
|
73 |
formData.append('factor', multiplicationFactor.value);
|
74 |
|
75 |
fetch('/process', {
|
|
|
10 |
const downloadLink = document.getElementById('downloadLink');
|
11 |
|
12 |
let isDecrypting = false;
|
13 |
+
let currentFile = null;
|
14 |
|
15 |
['dragenter', 'dragover', 'dragleave', 'drop'].forEach(eventName => {
|
16 |
dropArea.addEventListener(eventName, preventDefaults, false);
|
|
|
51 |
|
52 |
function handleFiles(files) {
|
53 |
if (files.length > 0) {
|
54 |
+
currentFile = files[0];
|
55 |
+
isDecrypting = currentFile.type === 'audio/mpeg';
|
56 |
options.style.display = 'block';
|
57 |
processButton.textContent = isDecrypting ? 'Deconvert' : 'Convert';
|
58 |
+
dropArea.textContent = `File selected: ${currentFile.name}`;
|
59 |
}
|
60 |
}
|
61 |
|
|
|
64 |
});
|
65 |
|
66 |
processButton.addEventListener('click', function() {
|
67 |
+
if (!currentFile) {
|
|
|
68 |
alert('Please select a file first.');
|
69 |
return;
|
70 |
}
|
71 |
|
72 |
const formData = new FormData();
|
73 |
+
formData.append('file', currentFile);
|
74 |
formData.append('factor', multiplicationFactor.value);
|
75 |
|
76 |
fetch('/process', {
|