malaknihed commited on
Commit
24dc099
·
verified ·
1 Parent(s): abad260

Update static/script.js

Browse files
Files changed (1) hide show
  1. static/script.js +7 -35
static/script.js CHANGED
@@ -502,41 +502,13 @@ function loadResumerPage() {
502
 
503
  const data = await response.json();
504
 
505
- if (data.translated_text) {
506
- resultElement.innerHTML = `
507
- <div style="display: flex; align-items: center; justify-content: flex-end; margin-bottom: 10px;">
508
- <button id="playAnswerVoiceBtn" style="
509
- background: linear-gradient(125deg, rgba(163, 94, 237, 0.9) 0%, rgba(65, 159, 232, 0.9) 75%);
510
- color: white;
511
- border: none;
512
- padding: 10px 16px;
513
- border-radius: 12px;
514
- cursor: pointer;
515
- font-size: 14px;
516
- box-shadow: 0 4px 6px rgba(0,0,0,0.1);
517
- transition: transform 0.2s;
518
- ">
519
- 🔊 Listen to Translation
520
- </button>
521
- </div>
522
- 📝 Translation :\n ${data.translated_text}
523
- `;
524
-
525
- // 🎤 Add the speech functionality
526
- const playVoiceBtn = document.getElementById("playAnswerVoiceBtn");
527
- playVoiceBtn.addEventListener("click", function () {
528
- const textToRead = data.translated_text;
529
- const utterance = new SpeechSynthesisUtterance(textToRead);
530
- utterance.lang = "en-US"; // Adjust the language if necessary
531
- window.speechSynthesis.speak(utterance);
532
- });
533
-
534
- // Store the translated text for later download
535
- resultElement.dataset.translatedText = data.translated_text;
536
-
537
- // Show the download section
538
- document.getElementById("downloadSection").style.display = "block";
539
- } else {
540
  resultElement.innerText = "❌ Translation not available.";
541
  }
542
  } catch (error) {
 
502
 
503
  const data = await response.json();
504
 
505
+ if (data.translated_text) {
506
+ resultElement.innerText = "📝 Traduction :\n " + data.translated_text;
507
+ // Stocker le texte traduit pour le téléchargement
508
+ resultElement.dataset.translatedText = data.translated_text;
509
+ // Afficher les options de téléchargement
510
+ document.getElementById("downloadSection").style.display = "block";
511
+ } else {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
512
  resultElement.innerText = "❌ Translation not available.";
513
  }
514
  } catch (error) {