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 () {
|
document.addEventListener('DOMContentLoaded', function () {
|
||||||
checkServerStatus("https://windelweb.org", "status-windelweb");
|
checkServerStatus("https://example-1.com", "Server-1");
|
||||||
checkServerStatus("https://app.windelgeschichten.org", "status-app-windelgeschichten");
|
checkServerStatus("https://example-2.com", "Server-2");
|
||||||
checkServerStatus("https://www.windelgeschichten.org", "status-windelgeschichten");
|
checkServerStatus("https://example-3.com", "Server-3");
|
||||||
checkServerStatus("https://windelweb.org/Helpdesk/", "status-m-viper");
|
checkServerStatus("https://example-4.com", "Server-4");
|
||||||
});
|
});
|
||||||
|
|
||||||
function checkServerStatus(url, statusElementId) {
|
function checkServerStatus(url, statusElementId) {
|
||||||
fetch(url)
|
fetch(url)
|
||||||
.then(response => {
|
.then(response => {
|
||||||
var statusElement = document.getElementById(statusElementId);
|
var statusElement = document.getElementById(statusElementId);
|
||||||
if (response.status === 200) {
|
if (response.status === 200) {
|
||||||
statusElement.textContent = 'Online';
|
statusElement.textContent = 'Online';
|
||||||
statusElement.style.color = '#00FF00'; // Grün für online
|
statusElement.style.color = '#00FF00'; // Grün für online
|
||||||
} else {
|
} else {
|
||||||
statusElement.textContent = 'Offline';
|
statusElement.textContent = 'Offline';
|
||||||
statusElement.style.color = '#FF0000'; // Rot für offline
|
statusElement.style.color = '#FF0000'; // Rot für offline
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
var statusElement = document.getElementById(statusElementId);
|
var statusElement = document.getElementById(statusElementId);
|
||||||
statusElement.textContent = 'Offline';
|
statusElement.textContent = 'Offline';
|
||||||
statusElement.style.color = '#FF0000'; // Rot für offline
|
statusElement.style.color = '#FF0000'; // Rot für offline
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue