summaryrefslogtreecommitdiffstats
path: root/lass/2configs/radio/controls.html
blob: 858dc3656e94bdd3c3415657a761ab09efc501fd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
<!doctype html>

<html lang="en">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">

  <title>The_Playlist Voting!</title>
<style>
#good {
    display: block;
  width: 100%;
  border: none;
  background-color: #04AA6D;
  padding: 14px;
  margin: 14px 0 0 0;
  height: 100px;
  font-size: 16px;
  cursor: pointer;
  text-align: center;
}
#bad {
    display: block;
  width: 100%;
  border: none;
  background-color: red;
  padding: 14px;
    height: 100px;

  margin: 14px 0 0 0;
  font-size: 16px;
  cursor: pointer;
  text-align: center;
}
</style>

</head>

<body>
  <div id=votenote></div>
  <button id=good type="button"> GUT </button>

  <button id=bad type="button"> SCHLECHT </button>
  <center>
    Currently Running: <br/><div>
      <b id=current></b>
    </div>
    <div id=vote>
    </div>
    <audio controls autoplay="autoplay">
      <source src="https://radio.lassul.us/radio.ogg" type="audio/ogg">
      Your browser does not support the audio element.
    </audio>
  </center>

  <script>
    document.getElementById("good").onclick=async ()=>{
      let result = await fetch("https://radio.lassul.us/good", {"method": "POST"})
      document.getElementById("vote").textContent =  "Dieses Lied findest du gut"
    };
    document.getElementById("bad").onclick=async ()=>{
      let result = await fetch("https://radio.lassul.us/skip", {"method": "POST"})
      document.getElementById("vote").textContent =  "Dieses Lied findest du schlecht"
      document.getElementById("bad").disabled = true
      window.setTimeout(function(){
        document.getElementById("bad").disabled = false
      }, 100000)

    };

    async function current() {
      let result = await fetch("https://radio.lassul.us/current", {"method": "GET"})
      let data = await result.json()
      document.getElementById("current").textContent = data.name
    }
    window.onload = function() {
      window.setInterval('current()', 10000)
      current()
    }

  </script>
</body>
</html>