diff options
| author | Physick <96335032+DegustatorPonos@users.noreply.github.com> | 2025-12-13 12:45:50 +0500 |
|---|---|---|
| committer | Physick <96335032+DegustatorPonos@users.noreply.github.com> | 2025-12-13 12:45:50 +0500 |
| commit | 44884dd29d8812cfd38f8fe2a8e3a28cfa944253 (patch) | |
| tree | d984abce773e286b04799ba3025e3c3ae4b7821d /static/index.js | |
| parent | ae11ed555cb350ea4c11fc1625f4a56229969ddd (diff) | |
Frontend changes
Diffstat (limited to 'static/index.js')
| -rw-r--r-- | static/index.js | 24 |
1 files changed, 19 insertions, 5 deletions
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; + } } |
