radioweb/index.html
2019-04-11 19:25:25 -04:00

83 lines
1.4 KiB
HTML

<html>
<head>
<title>APR</title>
<style>
body {
background: #000;
color: #ddd;
text-align:center;
}
h1 {
color: rgba(0,0,0,.1);
font-family: sans-serif;
font-size-adjust: 0.62;
font-synthesis: 12px;
font-variant: all-petite-caps;
letter-spacing: 2px;
margin-bottom: .5rem;
text-align: center;
text-shadow: 0px 0px 2px #ffffff;
}
h1 .wide {
letter-spacing: 9px;
color: rgba(0,0,0,.9);
}
audio, #history {
width: 75vw;
max-width: 1140px;
min-width: 320px;
border: 1px solid #888;
}
#history {
padding:0;
margin: 1rem auto;
font-size: 1.25rem;
line-height: 1.5;
list-style: none;
}
#history > :first-child {
font-weight: bold;
}
#history li:nth-child(even) {
background: #1d1d1d;
}
</style>
</head>
<body>
<h1>Anarchy PlⒶnet Radio</h1>
<audio id="player" controls src="https://radio.anarchyplanet.org:8443/radio.ogg"></audio>
<ul id="history"></ul>
<script>
var player = document.getElementById('player');
var rng = Math.floor(Math.random() * 10000);
player.src = player.src + '?nocache=' + rng;
var url = 'wss://radio.anarchyplanet.org/ws';
var ws = new WebSocket(url);
ws.onmessage = function(msg){
document.title = msg.data + " - APR";
var hist = document.getElementById("history");
hist.insertAdjacentHTML("afterbegin", `<li>${msg.data}</li>`);
if(hist.childElementCount >= 10) {
hist.removeChild(hist.lastChild);
}
}
</script>
</body>
</html>