modified: templates/quiz_multiplayer.html

This commit is contained in:
SimolZimol
2025-06-07 01:25:32 +02:00
parent b6583bbb3d
commit e976ea8a16

View File

@@ -96,7 +96,13 @@ function startMultiplayer(e) {
updateMultiplayerUI(); updateMultiplayerUI();
quizifyReady(); quizifyReady();
} }
window.addEventListener('DOMContentLoaded', fillPlayerFields); 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>
@@ -105,6 +111,7 @@ let currentGameMode = "{{ game_mode }}";
let correctAnswer = ""; let correctAnswer = "";
const i18n = {{ translations|tojson }}; const i18n = {{ translations|tojson }};
// Spotify Web Playback SDK
window.onSpotifyWebPlaybackSDKReady = () => { window.onSpotifyWebPlaybackSDKReady = () => {
const token = '{{ access_token }}'; const token = '{{ access_token }}';
const player = new Spotify.Player({ const player = new Spotify.Player({
@@ -267,18 +274,11 @@ window.onload = function() {
} }
document.getElementById('startPosition').value = getOption('startPosition', 'start'); document.getElementById('startPosition').value = getOption('startPosition', 'start');
updateMultiplayerUI(); updateMultiplayerUI();
// Popup immer anzeigen, falls vorhanden
if (document.getElementById('multiplayerPopup')) {
document.getElementById('multiplayerPopup').style.display = 'flex';
}
}; };
// Musikstart und Quiz erst nach Namensbestätigung!
function quizifyReady() { function quizifyReady() {
// Musik abspielen // Musik abspielen
if (window.spotifyPlayer && window.spotifyPlayer._options && window.spotifyPlayer._options.getOAuthToken) { if (window.spotifyPlayer && window.spotifyPlayer._options && window.spotifyPlayer._options.getOAuthToken) {
// Player ist schon initialisiert
const device_id = document.getElementById('device_id').value; const device_id = document.getElementById('device_id').value;
const playDuration = getPlayDuration(); const playDuration = getPlayDuration();
const startPosition = getOption('startPosition', 'start'); const startPosition = getOption('startPosition', 'start');