public/wunsch.html aktualisiert
This commit is contained in:
parent
721386bbd4
commit
d061668ab6
|
@ -5,7 +5,7 @@
|
|||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<link rel="stylesheet" href="css/styles.css">
|
||||
<link rel="icon" type="image/png" href="img/Viper-plex-logo.png">
|
||||
<title>Wunsch - Viper-Plex</title>
|
||||
<title id="web-title">${WEB_NAME}</title> <!-- Platzhalter für den Titel -->
|
||||
</head>
|
||||
<body>
|
||||
<!-- Logo separat einfügen -->
|
||||
|
@ -15,7 +15,7 @@
|
|||
</a>
|
||||
</div>
|
||||
<div class="welcome-box">
|
||||
<h1>Wunsch Seite</h1>
|
||||
<h1 id="welcome-title">${WEB_NAME}</h1> <!-- ID für das h1-Tag -->
|
||||
<nav class="navbar">
|
||||
<div class="navbar-container">
|
||||
<a href="index.html" class="navbar-link">Home</a>
|
||||
|
@ -65,72 +65,9 @@
|
|||
</div>
|
||||
|
||||
<footer class="footer">
|
||||
<p>© 2024 Viper-Plex. Alle Rechte vorbehalten.</p>
|
||||
<p>© 2024 M_Viper. Alle Rechte vorbehalten.</p>
|
||||
</footer>
|
||||
|
||||
<script>
|
||||
// Funktion, um die Umgebungsvariablen abzurufen
|
||||
const fetchEnvVariables = async () => {
|
||||
const response = await fetch('/api/env');
|
||||
const data = await response.json();
|
||||
|
||||
document.getElementById('bot-alias').textContent = data.botAlias;
|
||||
document.getElementById('telegram-link').href = data.telegramLink;
|
||||
};
|
||||
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
fetch('/api/telegram-link') // API-Endpunkt zum Abrufen des Telegram-Links
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
const telegramLink = document.getElementById('telegram-link');
|
||||
telegramLink.href = data.link; // Setze den Link im Anchor-Tag
|
||||
})
|
||||
.catch(error => console.error('Fehler beim Abrufen des Telegram-Links:', error));
|
||||
|
||||
// Version abrufen
|
||||
fetch('/api/bot-version')
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
const botVersion = document.getElementById('bot-version');
|
||||
botVersion.textContent = data.version; // Setze die Versionsnummer
|
||||
})
|
||||
.catch(error => console.error('Fehler beim Abrufen der Bot-Version:', error));
|
||||
|
||||
|
||||
// Handle form submission
|
||||
document.getElementById('wunsch-form').addEventListener('submit', function(event) {
|
||||
event.preventDefault();
|
||||
const wunsch = document.getElementById('wunsch').value;
|
||||
const type = document.getElementById('type').value;
|
||||
|
||||
fetch('/api/telegram-wunsch', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ wunsch, type })
|
||||
})
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
document.getElementById('response-message').textContent = data.message;
|
||||
})
|
||||
.catch(error => {
|
||||
document.getElementById('response-message').textContent = 'Fehler beim Senden des Wunsches: ' + error;
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
// Darkmode umschalten
|
||||
const toggle = document.getElementById('dark-mode-toggle');
|
||||
const darkModeEnabled = localStorage.getItem('darkMode') === 'true';
|
||||
toggle.checked = darkModeEnabled;
|
||||
if (darkModeEnabled) document.body.classList.add('dark-mode');
|
||||
|
||||
toggle.addEventListener('change', () => {
|
||||
const isChecked = toggle.checked;
|
||||
document.body.classList.toggle('dark-mode', isChecked);
|
||||
localStorage.setItem('darkMode', isChecked);
|
||||
});
|
||||
|
||||
|
||||
</script>
|
||||
<script src="js/script.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
Loading…
Reference in New Issue