summaryrefslogtreecommitdiff
path: root/main.js
diff options
context:
space:
mode:
Diffstat (limited to 'main.js')
-rw-r--r--main.js6
1 files changed, 6 insertions, 0 deletions
diff --git a/main.js b/main.js
index 2fc0098..818801b 100644
--- a/main.js
+++ b/main.js
@@ -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());