Fausto Busuito
commited on
Commit
·
7b4ae91
1
Parent(s):
037c967
Application changes
Browse files- app/static/script.js +14 -19
app/static/script.js
CHANGED
|
@@ -196,32 +196,27 @@ document.getElementById('end-session').addEventListener('click', () => {
|
|
| 196 |
<p><strong>Your score:</strong> ${score.toFixed(2)}%</p>
|
| 197 |
`;
|
| 198 |
|
| 199 |
-
// Aggiungi
|
| 200 |
-
const resultsContainer = document.getElementById('results-container');
|
| 201 |
-
resultsContainer.innerHTML = ''; // Pulisci i risultati precedenti
|
| 202 |
-
resultsContainer.appendChild(scoreDetails);
|
| 203 |
-
resultsContainer.appendChild(resultsTable);
|
| 204 |
-
|
| 205 |
-
// Aggiungi il pulsante "Return to Start"
|
| 206 |
const returnButton = document.createElement('button');
|
| 207 |
returnButton.innerText = 'Return to Start';
|
| 208 |
returnButton.style.marginTop = '20px';
|
| 209 |
-
returnButton.style.padding = '10px 20px';
|
| 210 |
-
returnButton.style.backgroundColor = '#007bff';
|
| 211 |
-
returnButton.style.color = 'white';
|
| 212 |
-
returnButton.style.border = 'none';
|
| 213 |
-
returnButton.style.cursor = 'pointer';
|
| 214 |
-
|
| 215 |
-
// Aggiungi l'evento per il pulsante "Return to Start"
|
| 216 |
returnButton.addEventListener('click', () => {
|
| 217 |
-
// Nascondi i risultati
|
|
|
|
| 218 |
document.getElementById('quiz-container').style.display = 'block';
|
| 219 |
-
|
| 220 |
-
|
| 221 |
-
|
| 222 |
-
|
|
|
|
|
|
|
| 223 |
});
|
| 224 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 225 |
resultsContainer.appendChild(returnButton);
|
| 226 |
|
| 227 |
// Mostra il contenitore dei risultati e nascondi il quiz
|
|
|
|
| 196 |
<p><strong>Your score:</strong> ${score.toFixed(2)}%</p>
|
| 197 |
`;
|
| 198 |
|
| 199 |
+
// Aggiungi il pulsante per tornare alla schermata iniziale
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 200 |
const returnButton = document.createElement('button');
|
| 201 |
returnButton.innerText = 'Return to Start';
|
| 202 |
returnButton.style.marginTop = '20px';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 203 |
returnButton.addEventListener('click', () => {
|
| 204 |
+
// Nascondi i risultati
|
| 205 |
+
document.getElementById('results-container').style.display = 'none';
|
| 206 |
document.getElementById('quiz-container').style.display = 'block';
|
| 207 |
+
|
| 208 |
+
// Resetta lo stato per una nuova sessione
|
| 209 |
+
userAnswers = []; // Resetta le risposte dell'utente
|
| 210 |
+
currentQuestionIndex = 0; // Ripristina l'indice della domanda
|
| 211 |
+
// Reset della selezione file (se necessario)
|
| 212 |
+
document.getElementById('file-selector').value = ''; // Reset del selettore del file (se usato)
|
| 213 |
});
|
| 214 |
|
| 215 |
+
// Aggiungi i dettagli del punteggio, la tabella e il pulsante alla schermata dei risultati
|
| 216 |
+
const resultsContainer = document.getElementById('results-container');
|
| 217 |
+
resultsContainer.innerHTML = ''; // Pulisci i risultati precedenti
|
| 218 |
+
resultsContainer.appendChild(scoreDetails);
|
| 219 |
+
resultsContainer.appendChild(resultsTable);
|
| 220 |
resultsContainer.appendChild(returnButton);
|
| 221 |
|
| 222 |
// Mostra il contenitore dei risultati e nascondi il quiz
|