improve livegame display

This commit is contained in:
2021-07-24 13:25:20 +02:00
parent 23fa7f9862
commit c5b7963fff

View File

@@ -13,12 +13,16 @@
<div id="playerDisplay" class="playerDisplay mb-3 mt-2"> <div id="playerDisplay" class="playerDisplay mb-3 mt-2">
<script> <script>
function players(){ function players(){
//document.getElementById("playerDisplay").classList.remove("animate-flicker")
fetch("/players-online").then( fetch("/players-online").then(
response => response.json() response => response.json()
).then( ).then(
data => { data => {
if(data["error"] == ""){ if(data["error"] == ""){
document.getElementById("playerDisplay").innerHTML = "Players Online: " + data["player_total"] document.getElementById("playerDisplay").innerHTML = "Players Online: " + data["player_total"]
if(parseInt(data["player_total"]) == 0){
//document.getElementById("playerDisplay").classList.add("animate-flicker")
}
}else{ }else{
document.getElementById("playerDisplay").innerHTML = "Players Online: (error)" + data["error"] document.getElementById("playerDisplay").innerHTML = "Players Online: (error)" + data["error"]
} }
@@ -26,7 +30,7 @@
) )
} }
players() players()
setInterval(players, 2000) setInterval(players, 10000)
</script> </script>
</div> </div>
<table id="tableMain" class="table table-striped table-bordered table-sm" <table id="tableMain" class="table table-striped table-bordered table-sm"