Prepare Build and Testing executable binary / Prepare-Build-Testing-With-Make (push) Has been cancelled
Prepare Build and Testing executable binary / Prepare-Build-Testing-With-CMake (push) Has been cancelled
Prepare Build and Testing executable binary / Prepare-Build-Testing-With-Meson (push) Has been cancelled
24 lines
864 B
JavaScript
24 lines
864 B
JavaScript
const uptime = document.querySelector('#infouptime')
|
|
|
|
const get_uptime = () => {
|
|
fetch(routes.uptime()).then(data => data.json()).then(jsondata => {
|
|
if (jsondata.uptime.hour === '0' && jsondata.uptime.minute === '0') {
|
|
uptime.value = jsondata.uptime.second + "s "
|
|
return
|
|
}
|
|
if (jsondata.uptime.hour === '0') {
|
|
uptime.value = jsondata.uptime.minute + "m " + jsondata.uptime.second + "s "
|
|
return
|
|
}
|
|
uptime.value = jsondata.uptime.hour + "h " + jsondata.uptime.minute + "m " + jsondata.uptime.second + "s "
|
|
}).catch((error) => {
|
|
notification(`Ошибка на сервере: ${error}`, "error")
|
|
})
|
|
}
|
|
|
|
window.addEventListener('load', () => {
|
|
if (infosection.classList.contains('active')) {
|
|
uptimeintervalid = setInterval(get_uptime, 1000)
|
|
}
|
|
})
|