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

Update static/script.js

Browse files
Files changed (1) hide show
  1. static/script.js +35 -21
static/script.js CHANGED
@@ -115,27 +115,41 @@ function loadResumerPage() {
115
  return;
116
  }
117
 
118
- if (data.summary) {
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
  }
141
  } catch (error) {
 
115
  return;
116
  }
117
 
118
+ if (data.summary) {
119
+ resultElement.innerHTML = `
120
+ <div style="display: flex; align-items: center; justify-content: flex-end; margin-bottom: 10px;">
121
+ <button id="playVoiceBtn" style="
122
+ background: linear-gradient(125deg, rgba(163, 94, 237, 0.9) 0%, rgba(65, 159, 232, 0.9) 75%);
123
+ color: white;
124
+ border: none;
125
+ padding: 10px 16px;
126
+ border-radius: 12px;
127
+ cursor: pointer;
128
+ font-size: 14px;
129
+ box-shadow: 0 4px 6px rgba(0,0,0,0.1);
130
+ transition: transform 0.2s;
131
+ ">
132
+ 🔊 Listen to Summary
133
+ </button>
134
+ </div>
135
+ <h3 class="centered-title">📝 Summary generated :</h3>
136
+ <br>
137
+ <p id="summaryText" style="font-size: 16px;">${data.summary}</p>
138
+ `;
139
+
140
+ document.getElementById("documentResult").dataset.summaryText = data.summary;
141
+ document.getElementById("downloadSection").style.display = "block";
142
+
143
+ // 🎤 Ajouter l'effet vocal
144
+ const playVoiceBtn = document.getElementById("playVoiceBtn");
145
+ playVoiceBtn.addEventListener("click", function () {
146
+ const textToRead = document.getElementById("summaryText").textContent;
147
+ const utterance = new SpeechSynthesisUtterance(textToRead);
148
+ utterance.lang = "en-US"; // ou "fr-FR" si ton résumé est en français
149
+ window.speechSynthesis.speak(utterance);
150
+ });
151
+ }
152
+ else {
153
  resultElement.innerText = "❌ Summary not available.";
154
  }
155
  } catch (error) {