modified: templates/quiz_multiplayer.html
This commit is contained in:
@@ -314,12 +314,13 @@
|
||||
if (data.correct) {
|
||||
resultContainer.className = 'result-container correct';
|
||||
resultContainer.innerHTML = `<h3>${i18n.correct}</h3>`;
|
||||
scores[current] = (scores[current] || 0) + 1;
|
||||
localStorage.setItem('quizify_multiplayer_scores', JSON.stringify(scores));
|
||||
// Punkte werden jetzt NICHT hier gezählt!
|
||||
resultContainer.dataset.wasCorrect = "1";
|
||||
} else {
|
||||
resultContainer.className = 'result-container incorrect';
|
||||
resultContainer.innerHTML = `<h3>${i18n.wrong}</h3>
|
||||
<p>${i18n.right_answer} <strong>${data.correct_answer}</strong></p>`;
|
||||
resultContainer.dataset.wasCorrect = "0";
|
||||
}
|
||||
resultContainer.innerHTML += `
|
||||
<div style="margin-top:10px;">
|
||||
@@ -331,14 +332,28 @@
|
||||
<a href="{{ track.external_urls.spotify }}" target="_blank" style="color:#1DB954;">${i18n.open_on_spotify}</a>
|
||||
</div>
|
||||
`;
|
||||
// Nächster Spieler
|
||||
let next = (current + 1) % names.length;
|
||||
localStorage.setItem('quizify_multiplayer_current', next);
|
||||
updateMultiplayerUI();
|
||||
document.getElementById('nextQuestionBtn').style.display = 'inline-block';
|
||||
});
|
||||
}
|
||||
|
||||
document.getElementById('nextQuestionBtn').addEventListener('click', function(e) {
|
||||
// Punkte und Spielerwechsel erst jetzt!
|
||||
const names = JSON.parse(localStorage.getItem('quizify_multiplayer_names') || "[]");
|
||||
const scores = JSON.parse(localStorage.getItem('quizify_multiplayer_scores') || "[]");
|
||||
let current = parseInt(localStorage.getItem('quizify_multiplayer_current') || "0");
|
||||
const resultContainer = document.getElementById('resultContainer');
|
||||
if (resultContainer.dataset.wasCorrect === "1") {
|
||||
scores[current] = (scores[current] || 0) + 1;
|
||||
localStorage.setItem('quizify_multiplayer_scores', JSON.stringify(scores));
|
||||
}
|
||||
// Nächster Spieler
|
||||
let next = (current + 1) % names.length;
|
||||
localStorage.setItem('quizify_multiplayer_current', next);
|
||||
updateMultiplayerUI();
|
||||
// Button funktioniert wie gehabt (Seitenwechsel)
|
||||
// Kein preventDefault!
|
||||
});
|
||||
|
||||
function switchGameMode(mode) {
|
||||
// Multiplayer-Daten NICHT löschen, damit Namen erhalten bleiben!
|
||||
window.location.href = `/reset_quiz/{{ playlist_id }}?next_mode=${mode}&local_multiplayer=1`;
|
||||
|
||||
Reference in New Issue
Block a user