Dateien hochladen nach „“

This commit is contained in:
M_Viper 2023-11-01 16:14:11 +01:00
parent 19c6b452bd
commit 678478f164
4 changed files with 129 additions and 0 deletions

25
options.js Normal file
View File

@ -0,0 +1,25 @@
document.addEventListener('DOMContentLoaded', function () {
// Elemente aus dem DOM auswählen
const serverUrlInput = document.getElementById('server-url');
const addServerButton = document.getElementById('add-server');
const serverList = document.getElementById('server-list');
// Hinzufügen eines Servers beim Klicken auf den "Hinzufügen"-Button
addServerButton.addEventListener('click', function () {
const serverUrl = serverUrlInput.value;
if (serverUrl) {
const listItem = document.createElement('li');
listItem.textContent = serverUrl;
serverList.appendChild(listItem);
// Hier können Sie den ServerUrl speichern oder an eine Backend-API senden
// um die Server für die Überwachung in der Erweiterung zu verwenden
chrome.storage.local.get({ serverUrls: [] }, function (data) {
const serverUrls = data.serverUrls;
serverUrls.push(serverUrl);
chrome.storage.local.set({ serverUrls: serverUrls });
});
}
});
});

49
popup.css Normal file
View File

@ -0,0 +1,49 @@
body {
width: 400px;
text-align: center;
font-family: Arial, sans-serif;
background-image: url('bg.png');
background-size: cover;
background-repeat: no-repeat;
background-position: center;
padding: 20px;
background-color: rgba(10, 10, 10, 0.8);
}
.server-status {
background-color: rgba(255, 255, 255, 0.8);
border-radius: 10px;
padding: 20px;
box-shadow: 0px 0px 20px 0px rgba(0, 0, 0, 0.5);
text-align: center;
}
.server-status h1 {
font-size: 24px;
color: #333;
margin-bottom: 20px;
}
.server-box {
background-color: rgba(255, 255, 255, 0.9);
border-radius: 10px;
padding: 10px;
margin: 10px 0;
box-shadow: 0px 0px 10px 0px rgba(0, 0, 0, 0.3);
}
.server-box h2 {
font-size: 16px;
color: #333;
margin: 5px 0;
}
.server-box #status-windelweb,
.server-box #status-app-windelgeschichten,
.server-box #status-windelgeschichten,
.server-box #status-m-viper {
font-size: 14px;
font-weight: bold;
margin: 5px 0;
}

29
popup.html Normal file
View File

@ -0,0 +1,29 @@
<!DOCTYPE html>
<html>
<head>
<title>Server Status</title>
<script src="popup.js"></script>
<link rel="stylesheet" type="text/css" href="popup.css">
</head>
<body>
<div class="server-status">
<h1>Server Status</h1>
<div class="server-box" id="box-windelweb">
<h2>Windelweb</h2>
<div id="status-windelweb">Loading...</div>
</div>
<div class="server-box" id="box-app-windelgeschichten">
<h2>App Windelgeschichten</h2>
<div id="status-app-windelgeschichten">Loading...</div>
</div>
<div class="server-box" id="box-windelgeschichten">
<h2>Windelgeschichten</h2>
<div id="status-windelgeschichten">Loading...</div>
</div>
<div class="server-box" id="box-m-viper">
<h2>M-Viper</h2>
<div id="status-m-viper">Loading...</div>
</div>
</div>
</body>
</html>

26
popup.js Normal file
View File

@ -0,0 +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
});
}