Fausto Busuito
commited on
Commit
·
037c967
1
Parent(s):
8a5b93a
Application changes
Browse files- app/static/script.js +22 -10
app/static/script.js
CHANGED
@@ -71,10 +71,6 @@ function displayQuestion() {
|
|
71 |
optionsDiv.appendChild(form);
|
72 |
}
|
73 |
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
function selectAnswer(optionIndex) {
|
79 |
const currentAnswers = userAnswers[currentIndex];
|
80 |
if (currentAnswers.includes(optionIndex)) {
|
@@ -206,17 +202,33 @@ document.getElementById('end-session').addEventListener('click', () => {
|
|
206 |
resultsContainer.appendChild(scoreDetails);
|
207 |
resultsContainer.appendChild(resultsTable);
|
208 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
209 |
// Mostra il contenitore dei risultati e nascondi il quiz
|
210 |
document.getElementById('quiz-container').style.display = 'none';
|
211 |
resultsContainer.style.display = 'block';
|
212 |
});
|
213 |
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
document.getElementById('restart').addEventListener('click', () => {
|
221 |
document.getElementById('results-container').style.display = 'none';
|
222 |
document.getElementById('file-selection').style.display = 'block';
|
|
|
71 |
optionsDiv.appendChild(form);
|
72 |
}
|
73 |
|
|
|
|
|
|
|
|
|
74 |
function selectAnswer(optionIndex) {
|
75 |
const currentAnswers = userAnswers[currentIndex];
|
76 |
if (currentAnswers.includes(optionIndex)) {
|
|
|
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 e mostra il quiz
|
218 |
+
document.getElementById('quiz-container').style.display = 'block';
|
219 |
+
resultsContainer.style.display = 'none';
|
220 |
+
userAnswers = []; // Resetta le risposte
|
221 |
+
currentQuestionIndex = 0; // Resetta l'indice della domanda corrente
|
222 |
+
startQuiz(); // Riprendi il quiz
|
223 |
+
});
|
224 |
+
|
225 |
+
resultsContainer.appendChild(returnButton);
|
226 |
+
|
227 |
// Mostra il contenitore dei risultati e nascondi il quiz
|
228 |
document.getElementById('quiz-container').style.display = 'none';
|
229 |
resultsContainer.style.display = 'block';
|
230 |
});
|
231 |
|
|
|
|
|
|
|
|
|
|
|
|
|
232 |
document.getElementById('restart').addEventListener('click', () => {
|
233 |
document.getElementById('results-container').style.display = 'none';
|
234 |
document.getElementById('file-selection').style.display = 'block';
|