FestivalServer/Public/festival/assets/festival-info.js
2022-03-26 09:55:22 +01:00

34 lines
1.3 KiB
JavaScript

function loadList(name, source) {
document.getElementById("left-button").style.backgroundColor = 'rgba(255, 255, 255, 0.1)'
document.getElementById("middle-button").style.backgroundColor = 'rgba(255, 255, 255, 0.1)'
document.getElementById("right-button").style.backgroundColor = 'rgba(255, 255, 255, 0.1)'
source.style.backgroundColor = 'rgba(255, 255, 255, 0.3)'
var txtFile = new XMLHttpRequest();
var allText = "Liste nicht geladen";
txtFile.onreadystatechange = function () {
if (txtFile.readyState === XMLHttpRequest.DONE && txtFile.status == 200) {
allText = txtFile.responseText.split("\n").join("<br>");
}
document.getElementById("remote-content").innerHTML = allText;
}
var list = '/festival/lists/' + name;
txtFile.open("GET", list, true);
txtFile.send(null);
}
function loadCount() {
var txtFile = new XMLHttpRequest();
var allText = "";
txtFile.onreadystatechange = function () {
if (txtFile.readyState === XMLHttpRequest.DONE && txtFile.status == 200) {
allText = txtFile.responseText;
}
document.getElementById("left-button").innerHTML = "Registered (" + allText + ")";
}
var list = '/festival/api/count' + name;
txtFile.open("GET", list, true);
txtFile.send(null);
}