popup.js aktualisiert
This commit is contained in:
parent
f514953e84
commit
ec65a3274e
50
popup.js
50
popup.js
|
@ -1,26 +1,26 @@
|
|||
document.addEventListener('DOMContentLoaded', function () {
|
||||
checkServerStatus("https://windelweb.org", "status-windelweb");
|
||||
checkServerStatus("https://app.windelgeschichten.org", "status-app-windelgeschichten");
|
||||
checkServerStatus("https://www.windelgeschichten.org", "status-windelgeschichten");
|
||||
checkServerStatus("https://windelweb.org/Helpdesk/", "status-m-viper");
|
||||
});
|
||||
|
||||
function checkServerStatus(url, statusElementId) {
|
||||
fetch(url)
|
||||
.then(response => {
|
||||
var statusElement = document.getElementById(statusElementId);
|
||||
if (response.status === 200) {
|
||||
statusElement.textContent = 'Online';
|
||||
statusElement.style.color = '#00FF00'; // Grün für online
|
||||
} else {
|
||||
statusElement.textContent = 'Offline';
|
||||
statusElement.style.color = '#FF0000'; // Rot für offline
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
var statusElement = document.getElementById(statusElementId);
|
||||
statusElement.textContent = 'Offline';
|
||||
statusElement.style.color = '#FF0000'; // Rot für offline
|
||||
});
|
||||
}
|
||||
document.addEventListener('DOMContentLoaded', function () {
|
||||
checkServerStatus("https://example-1.com", "Server-1");
|
||||
checkServerStatus("https://example-2.com", "Server-2");
|
||||
checkServerStatus("https://example-3.com", "Server-3");
|
||||
checkServerStatus("https://example-4.com", "Server-4");
|
||||
});
|
||||
|
||||
function checkServerStatus(url, statusElementId) {
|
||||
fetch(url)
|
||||
.then(response => {
|
||||
var statusElement = document.getElementById(statusElementId);
|
||||
if (response.status === 200) {
|
||||
statusElement.textContent = 'Online';
|
||||
statusElement.style.color = '#00FF00'; // Grün für online
|
||||
} else {
|
||||
statusElement.textContent = 'Offline';
|
||||
statusElement.style.color = '#FF0000'; // Rot für offline
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
var statusElement = document.getElementById(statusElementId);
|
||||
statusElement.textContent = 'Offline';
|
||||
statusElement.style.color = '#FF0000'; // Rot für offline
|
||||
});
|
||||
}
|
||||
|
Loading…
Reference in New Issue