From 44884dd29d8812cfd38f8fe2a8e3a28cfa944253 Mon Sep 17 00:00:00 2001 From: Physick <96335032+DegustatorPonos@users.noreply.github.com> Date: Sat, 13 Dec 2025 12:45:50 +0500 Subject: Frontend changes --- static/index.js | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) (limited to 'static/index.js') diff --git a/static/index.js b/static/index.js index 6cda2f7..237386c 100644 --- a/static/index.js +++ b/static/index.js @@ -1,3 +1,4 @@ +let isInfoShown = true; function GetSongs() { fetch("/api/getSongs").then(r => r.json().then(body => { @@ -11,24 +12,37 @@ function SetRandomSong() { console.log(player); console.log(body); player.src = "/api/getSong?name=" + encodeURI(body.Name); - player.play(); - document.getElementById("Artist").innerHTML = "Artist: " + body.Meta.Name; - document.getElementById("Title").innerHTML = "Title: " + body.Meta.Author; + document.getElementById("Artist").innerHTML = "Artist: " + body.Meta.Author; + document.getElementById("Title").innerHTML = "Title: " + body.Meta.Name; document.getElementById("Album").innerHTML = "Album: " + body.Meta.Album; document.getElementById("Start").innerHTML = "Start: " + body.Start + "s"; + player.play(); + document.getElementById("Status").innerHTML = "Playing"; })); } function Pause() { const player = document.getElementById("mainAudio"); player.pause(); - console.log("Paused audio"); + document.getElementById("Status").innerHTML = "Paused"; } function Resume() { const player = document.getElementById("mainAudio"); player.play(); - console.log("Paused audio"); + document.getElementById("Status").innerHTML = "Playing"; +} + +function ToggleInfo() { + if (isInfoShown) { + document.getElementById("InfoBlock").style.display = 'none'; + document.getElementById("ToggleBtn").innerHTML = 'Show info'; + isInfoShown = false; + } else { + document.getElementById("InfoBlock").style.display = 'block'; + document.getElementById("ToggleBtn").innerHTML = 'Hide info'; + isInfoShown = true; + } } -- cgit v1.3