Auto-reload server status every 15 sec
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
MinecraftAPI.getServerStatus('panic-shack.hallada.net', {
|
function getStatus() {
|
||||||
|
MinecraftAPI.getServerStatus('panic-shack.hallada.net', {
|
||||||
port: 25565
|
port: 25565
|
||||||
}, function (err, status) {
|
}, function (err, status) {
|
||||||
var serverError = document.getElementById('server-status-error');
|
var serverError = document.getElementById('server-status-error');
|
||||||
var serverStatus = document.getElementById('server-status');
|
var serverStatus = document.getElementById('server-status');
|
||||||
|
|
||||||
@@ -26,4 +27,11 @@ MinecraftAPI.getServerStatus('panic-shack.hallada.net', {
|
|||||||
document.getElementById('status-server-protocol').textContent = status.server.protocol;
|
document.getElementById('status-server-protocol').textContent = status.server.protocol;
|
||||||
document.getElementById('status-last-online').textContent = moment.unix(parseInt(status.last_online, 10)).fromNow();
|
document.getElementById('status-last-online').textContent = moment.unix(parseInt(status.last_online, 10)).fromNow();
|
||||||
document.getElementById('status-last-updated').textContent = moment.unix(parseInt(status.last_updated, 10)).fromNow();
|
document.getElementById('status-last-updated').textContent = moment.unix(parseInt(status.last_updated, 10)).fromNow();
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
getStatus();
|
||||||
|
|
||||||
|
setInterval(function () {
|
||||||
|
getStatus();
|
||||||
|
}, 15000);
|
||||||
|
|||||||
Reference in New Issue
Block a user