soundboard/templates/settings.html
2025-09-20 20:06:01 +10:00

55 lines
1.8 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Soundboard settings</title>
<style>
body {
background-color: dimgray;
}
</style>
</head>
<body>
<h1>Settings:</h2>
<div>
<ul style="list-style: none;">
<li>Volume: <span id="vol">{{config.current_volume * 100}}</span> <input type="range" min="0" max="100"
class="slider" id="volume_slider" onchange="update_volume_label()"
value="{{config.current_volume * 100}}"></input>
<button onclick="change_volume()">Change</button>
</li>
<li></li>
<li></li>
<li><button onclick="reload_sounds()">Reload Sounds</button></li>
</ul>
</div>
<script>
function change_volume() {
slider = document.getElementById('volume_slider')
vol_num = document.getElementById('vol')
volume = slider.value
fetch("/vol", { method: "POST", body: volume / 100, headers: { "Content-Type": "application/json" } })
.then(x => x.body)
.then(console.log("Changed_volume"))
vol_num.innerHTML = volume
}
function reload_sounds() {
fetch("/reload")
.then(x => x.body)
.then(console.log("Sounds reloaded"))
}
function update_volume_label() {
slider = document.getElementById('volume_slider')
vol_num = document.getElementById('vol')
volume = slider.value
vol_num.innerHTML = volume
}
</script>
</body>
</html>