modified: templates/quiz_multiplayer.html
This commit is contained in:
@@ -56,6 +56,12 @@
|
|||||||
</div>
|
</div>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
{% block extra_body %}
|
{% 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');
|
||||||
|
</script>
|
||||||
{% if local_multiplayer %}
|
{% 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;">
|
<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;">
|
||||||
<div style="background:#191414;padding:30px 40px;border-radius:18px;box-shadow:0 8px 32px 0 rgba(0,0,0,0.37);min-width:320px;text-align:center;">
|
<div style="background:#191414;padding:30px 40px;border-radius:18px;box-shadow:0 8px 32px 0 rgba(0,0,0,0.37);min-width:320px;text-align:center;">
|
||||||
@@ -71,13 +77,6 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<script>
|
<script>
|
||||||
function fillPlayerFields() {
|
|
||||||
// Namen aus LocalStorage vorbefüllen
|
|
||||||
const names = JSON.parse(localStorage.getItem('quizify_multiplayer_names') || "[]");
|
|
||||||
for(let i=1;i<=4;i++) {
|
|
||||||
document.getElementById('player'+i).value = names[i-1] || "";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
function startMultiplayer(e) {
|
function startMultiplayer(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
const names = [];
|
const names = [];
|
||||||
@@ -96,13 +95,6 @@ function startMultiplayer(e) {
|
|||||||
updateMultiplayerUI();
|
updateMultiplayerUI();
|
||||||
quizifyReady(); // Musik und Quiz jetzt starten!
|
quizifyReady(); // Musik und Quiz jetzt starten!
|
||||||
}
|
}
|
||||||
window.addEventListener('DOMContentLoaded', function() {
|
|
||||||
fillPlayerFields();
|
|
||||||
// Popup IMMER anzeigen, falls vorhanden
|
|
||||||
if (document.getElementById('multiplayerPopup')) {
|
|
||||||
document.getElementById('multiplayerPopup').style.display = 'flex';
|
|
||||||
}
|
|
||||||
});
|
|
||||||
</script>
|
</script>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<script>
|
<script>
|
||||||
@@ -276,6 +268,11 @@ window.onload = function() {
|
|||||||
}
|
}
|
||||||
document.getElementById('startPosition').value = getOption('startPosition', 'start');
|
document.getElementById('startPosition').value = getOption('startPosition', 'start');
|
||||||
updateMultiplayerUI();
|
updateMultiplayerUI();
|
||||||
|
|
||||||
|
// Popup immer anzeigen, weil LocalStorage oben geleert wurde
|
||||||
|
if (document.getElementById('multiplayerPopup')) {
|
||||||
|
document.getElementById('multiplayerPopup').style.display = 'flex';
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// Musikstart und Quiz erst nach Namensbestätigung!
|
// Musikstart und Quiz erst nach Namensbestätigung!
|
||||||
|
|||||||
Reference in New Issue
Block a user