Sergidev commited on
Commit
b2fe4e6
·
verified ·
1 Parent(s): 0940b20

Update static/script.js

Browse files
Files changed (1) hide show
  1. static/script.js +8 -7
static/script.js CHANGED
@@ -54,15 +54,11 @@ document.addEventListener('DOMContentLoaded', () => {
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
 
62
- multiplicationFactor.addEventListener('input', function() {
63
- factorValue.textContent = this.value;
64
- });
65
-
66
  processButton.addEventListener('click', function() {
67
  if (!currentFile) {
68
  alert('Please select a file first.');
@@ -89,9 +85,14 @@ document.addEventListener('DOMContentLoaded', () => {
89
  }
90
  const url = URL.createObjectURL(blob);
91
  result.style.display = 'block';
92
- audioPlayer.src = url;
 
 
 
 
 
93
  downloadLink.href = url;
94
- downloadLink.download = isDecrypting ? 'deconverted_file.wav' : 'converted_file.mp3';
95
  console.log('File processed successfully. Size:', blob.size, 'bytes');
96
  })
97
  .catch(error => {
 
54
  currentFile = files[0];
55
  isDecrypting = currentFile.type === 'audio/mpeg';
56
  options.style.display = 'block';
57
+ processButton.textContent = isDecrypting ? 'Decrypt' : 'Encrypt';
58
  dropArea.textContent = `File selected: ${currentFile.name}`;
59
  }
60
  }
61
 
 
 
 
 
62
  processButton.addEventListener('click', function() {
63
  if (!currentFile) {
64
  alert('Please select a file first.');
 
85
  }
86
  const url = URL.createObjectURL(blob);
87
  result.style.display = 'block';
88
+ if (isDecrypting) {
89
+ audioPlayer.style.display = 'none';
90
+ } else {
91
+ audioPlayer.style.display = 'block';
92
+ audioPlayer.src = url;
93
+ }
94
  downloadLink.href = url;
95
+ downloadLink.download = isDecrypting ? 'decrypted_file' : 'encrypted.mp3';
96
  console.log('File processed successfully. Size:', blob.size, 'bytes');
97
  })
98
  .catch(error => {