malaknihed commited on
Commit
a2c3e29
·
verified ·
1 Parent(s): d46ff85

Update static/script.js

Browse files
Files changed (1) hide show
  1. static/script.js +15 -3
static/script.js CHANGED
@@ -14,7 +14,7 @@ function loadResumerPage() {
14
  appContainer.innerHTML = `
15
  <div class="sidebar">
16
  <div class="logo-container">
17
- <div class="logo-top">SMARTDOCS</div>
18
  <div class="logo-bottom">AI</div>
19
  </div>
20
  <a href="principal.html" class="home-link">
@@ -119,10 +119,22 @@ function loadResumerPage() {
119
  resultElement.innerHTML = `
120
  <h3 class="centered-title">📝 Summary generated :</h3>
121
  <br>
122
- <p>${data.summary}</p>
123
- `;
 
 
 
124
  document.getElementById("documentResult").dataset.summaryText = data.summary;
125
  document.getElementById("downloadSection").style.display = "block";
 
 
 
 
 
 
 
 
 
126
  } else {
127
  resultElement.innerText = "❌ Summary not available.";
128
  }
 
14
  appContainer.innerHTML = `
15
  <div class="sidebar">
16
  <div class="logo-container">
17
+ <div class="logo-top">SMARTDOC</div>
18
  <div class="logo-bottom">AI</div>
19
  </div>
20
  <a href="principal.html" class="home-link">
 
119
  resultElement.innerHTML = `
120
  <h3 class="centered-title">📝 Summary generated :</h3>
121
  <br>
122
+ <p id="summaryText">${data.summary}</p>
123
+ <button id="playVoiceBtn" style="margin-top: 15px; padding: 10px; border: none; background-color: #4CAF50; color: white; border-radius: 8px; cursor: pointer;">
124
+ 🔊 Listen to summary
125
+ </button>
126
+ `;
127
  document.getElementById("documentResult").dataset.summaryText = data.summary;
128
  document.getElementById("downloadSection").style.display = "block";
129
+ // 🎤 Ajouter l'effet vocal
130
+ const playVoiceBtn = document.getElementById("playVoiceBtn");
131
+ playVoiceBtn.addEventListener("click", function () {
132
+ const textToRead = document.getElementById("summaryText").textContent;
133
+ const utterance = new SpeechSynthesisUtterance(textToRead);
134
+ utterance.lang = "en-US"; // ou "fr-FR" si ton résumé est en français
135
+ window.speechSynthesis.speak(utterance);
136
+ });
137
+
138
  } else {
139
  resultElement.innerText = "❌ Summary not available.";
140
  }