17 lines
437 B
JavaScript
17 lines
437 B
JavaScript
const url = 'https://id-libre.org/live/status-json.xsl';
|
|
const statusElement = document.getElementById('on');
|
|
|
|
async function status() {
|
|
const response = await fetch(url);
|
|
const data = await response.json();
|
|
const status = data.icestats.source ? 'on' : 'off'
|
|
|
|
statusElement.innerHTML = status;
|
|
statusElement.classList.remove("on", "off");
|
|
statusElement.classList.add(status);
|
|
}
|
|
|
|
status();
|
|
|
|
setInterval(() => status(), 2000);
|