man kann "kein gerät" auswählen
parent
f53bafb918
commit
257e10c3b3
|
|
@ -18,6 +18,13 @@ area.appendChild(select);
|
||||||
|
|
||||||
async function loadDevices() {
|
async function loadDevices() {
|
||||||
select.innerHTML = "";
|
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)}`);
|
const devices = await fetchJson(`/api/spotify/devices?username=${encodeURIComponent(username)}`);
|
||||||
if (!devices.length) {
|
if (!devices.length) {
|
||||||
const opt = document.createElement("option");
|
const opt = document.createElement("option");
|
||||||
|
|
@ -34,6 +41,8 @@ async function loadDevices() {
|
||||||
select.appendChild(opt);
|
select.appendChild(opt);
|
||||||
});
|
});
|
||||||
select.disabled = false;
|
select.disabled = false;
|
||||||
|
select.value = ""; // "Kein Gerät" als Standard
|
||||||
|
|
||||||
}
|
}
|
||||||
loadDevices();
|
loadDevices();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -316,8 +316,9 @@ function handleGameEnd({ winner }) {
|
||||||
// Spotify-Playback Funktion (unverändert)
|
// Spotify-Playback Funktion (unverändert)
|
||||||
async function playOnSpotify(trackUri, username) {
|
async function playOnSpotify(trackUri, username) {
|
||||||
const deviceId = document.getElementById("deviceSelect")?.value;
|
const deviceId = document.getElementById("deviceSelect")?.value;
|
||||||
if (!deviceId) {
|
if (deviceId === "") {
|
||||||
alert("Bitte ein Wiedergabegerät auswählen!");
|
//alert("Bitte ein Wiedergabegerät auswählen!");
|
||||||
|
//keine warnung i guess
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue