modified: templates/quiz_multiplayer.html
This commit is contained in:
@@ -57,10 +57,12 @@
|
||||
{% endblock %}
|
||||
{% block extra_body %}
|
||||
<script>
|
||||
// Multiplayer-Daten IMMER beim Laden löschen, damit Popup immer erscheint
|
||||
localStorage.removeItem('quizify_multiplayer_names');
|
||||
localStorage.removeItem('quizify_multiplayer_scores');
|
||||
localStorage.removeItem('quizify_multiplayer_current');
|
||||
// Multiplayer-Daten NUR löschen, wenn keine Spielernamen gesetzt sind
|
||||
if (!localStorage.getItem('quizify_multiplayer_names')) {
|
||||
localStorage.removeItem('quizify_multiplayer_names');
|
||||
localStorage.removeItem('quizify_multiplayer_scores');
|
||||
localStorage.removeItem('quizify_multiplayer_current');
|
||||
}
|
||||
</script>
|
||||
{% if local_multiplayer %}
|
||||
<div id="multiplayerPopup" style="position:fixed;top:0;left:0;width:100vw;height:100vh;background:rgba(0,0,0,0.7);display:flex;align-items:center;justify-content:center;z-index:2000;">
|
||||
@@ -104,6 +106,7 @@ let correctAnswer = "";
|
||||
const i18n = {{ translations|tojson }};
|
||||
|
||||
window.onSpotifyWebPlaybackSDKReady = () => {
|
||||
// Musik und Quiz werden erst nach quizifyReady() gestartet!
|
||||
const token = '{{ access_token }}';
|
||||
const player = new Spotify.Player({
|
||||
name: 'Musik Quiz Player',
|
||||
@@ -276,9 +279,13 @@ window.onload = function() {
|
||||
}
|
||||
document.getElementById('startPosition').value = getOption('startPosition', 'start');
|
||||
|
||||
// Popup immer anzeigen, weil LocalStorage oben geleert wurde
|
||||
if (document.getElementById('multiplayerPopup')) {
|
||||
// Popup anzeigen, wenn keine Spielernamen gesetzt sind
|
||||
if (!localStorage.getItem('quizify_multiplayer_names') && document.getElementById('multiplayerPopup')) {
|
||||
document.getElementById('multiplayerPopup').style.display = 'flex';
|
||||
} else {
|
||||
// Wenn Namen schon gesetzt, direkt Quiz starten
|
||||
updateMultiplayerUI();
|
||||
quizifyReady();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user