|
|
|
@ -35,7 +35,7 @@ title: Ourcraft Server Status Checker |
|
|
|
|
function showServerStatus(key) { |
|
|
|
|
for (const name of ['server-status-check-failed', 'server-status-online', 'server-status-offline', 'server-status-loading']) { |
|
|
|
|
if (name == key) { |
|
|
|
|
document.getElementById(name).style.display = 'block' |
|
|
|
|
document.getElementById(name).style.display = null |
|
|
|
|
} else { |
|
|
|
|
document.getElementById(name).style.display = 'none' |
|
|
|
|
} |
|
|
|
@ -68,12 +68,12 @@ function handleOnlineStatus(status) { |
|
|
|
|
|
|
|
|
|
if ('players' in status) { |
|
|
|
|
if ('max' in status.players && 'now' in status.players) { |
|
|
|
|
info.style.display = 'block' |
|
|
|
|
info.style.display = null |
|
|
|
|
document.getElementById('server-status-current-num-players').textContent = status.players.now |
|
|
|
|
document.getElementById('server-status-max-players').textContent = status.players.max |
|
|
|
|
if ('sample' in status.players && status.players.now > 0) { |
|
|
|
|
samplingHeader.style.display = 'block' |
|
|
|
|
samplingList.style.display = 'block' |
|
|
|
|
samplingHeader.style.display = null |
|
|
|
|
samplingList.style.display = null |
|
|
|
|
samplingList.textContent = '' |
|
|
|
|
for (const player of status.players.sample) { |
|
|
|
|
const newListItem = document.createElement('li') |
|
|
|
@ -82,7 +82,7 @@ function handleOnlineStatus(status) { |
|
|
|
|
samplingList.appendChild(newListItem) |
|
|
|
|
} |
|
|
|
|
if (status.players.sample.length != status.players.now) { |
|
|
|
|
document.getElementById('server-status-player-sampling-insufficient').style.display = 'block' |
|
|
|
|
document.getElementById('server-status-player-sampling-insufficient').style.display = null |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|