diff options
Diffstat (limited to 'main.js')
-rw-r--r-- | main.js | 6 |
1 files changed, 6 insertions, 0 deletions
@@ -10,6 +10,7 @@ function random(){ fetch("/random") } function playlist(){ + let volume_slider = document.getElementById("volume") function f(){ fetch("/playlist").then(res => res.json()).then(res => { let el = document.getElementById("playlist") @@ -24,9 +25,14 @@ function playlist(){ li.innerHTML = my_html el.appendChild(li) }) + volume_slider.value = res.volume * 100 }) } var intervalId = setInterval(f, 5000); f() + + volume_slider.onchange = function() { + fetch(`/volume/${volume_slider.value/100}`) + } } window.addEventListener('load', event => playlist()); |