From 257e10c3b3d32cd09a4fcf747253e43396ade60b Mon Sep 17 00:00:00 2001 From: eric <3024947@stud.hs-mannheim.de> Date: Tue, 12 Aug 2025 02:59:22 +0200 Subject: [PATCH] =?UTF-8?q?man=20kann=20"kein=20ger=C3=A4t"=20ausw=C3=A4hl?= =?UTF-8?q?en?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/resources/public/js/device-select.js | 9 +++++++++ src/main/resources/public/js/game.js | 5 +++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/main/resources/public/js/device-select.js b/src/main/resources/public/js/device-select.js index 487fe5d..5b1027a 100644 --- a/src/main/resources/public/js/device-select.js +++ b/src/main/resources/public/js/device-select.js @@ -18,6 +18,13 @@ area.appendChild(select); async function loadDevices() { select.innerHTML = ""; + + // Standardoption "Kein Gerät" + const noneOpt = document.createElement("option"); + noneOpt.value = ""; + noneOpt.textContent = "Kein Gerät"; + select.appendChild(noneOpt); + const devices = await fetchJson(`/api/spotify/devices?username=${encodeURIComponent(username)}`); if (!devices.length) { const opt = document.createElement("option"); @@ -34,6 +41,8 @@ async function loadDevices() { select.appendChild(opt); }); select.disabled = false; + select.value = ""; // "Kein Gerät" als Standard + } loadDevices(); diff --git a/src/main/resources/public/js/game.js b/src/main/resources/public/js/game.js index e8b1964..2f7ef9c 100644 --- a/src/main/resources/public/js/game.js +++ b/src/main/resources/public/js/game.js @@ -316,8 +316,9 @@ function handleGameEnd({ winner }) { // Spotify-Playback Funktion (unverändert) async function playOnSpotify(trackUri, username) { const deviceId = document.getElementById("deviceSelect")?.value; - if (!deviceId) { - alert("Bitte ein Wiedergabegerät auswählen!"); + if (deviceId === "") { + //alert("Bitte ein Wiedergabegerät auswählen!"); + //keine warnung i guess return; } try {