|
|
@@ -31,14 +31,12 @@ if ($show_login):
|
|
|
input { width: 100%; padding: 12px; margin: 15px 0; border-radius: 5px; border: 1px solid var(--border); background: var(--card); color: var(--text); box-sizing: border-box; }
|
|
|
button { background: #e67e22; color: white; border: none; padding: 12px; border-radius: 5px; cursor: pointer; width: 100%; font-weight: bold; }
|
|
|
</style>
|
|
|
- <script>
|
|
|
- if (localStorage.getItem('theme') === 'dark') document.documentElement.classList.add('dark-theme');
|
|
|
- </script>
|
|
|
+ <script>if (localStorage.getItem('theme') === 'dark') document.documentElement.classList.add('dark-theme');</script>
|
|
|
</head>
|
|
|
<body>
|
|
|
<div class="login-box">
|
|
|
<h2>🔐 Admin Login</h2>
|
|
|
- <?php if(isset($login_error)) echo "<div style='color:red;'>$login_error</div>"; ?>
|
|
|
+ <?php if(isset($login_error)) echo "<div style='color:red; margin-bottom:10px;'>$login_error</div>"; ?>
|
|
|
<form method="POST">
|
|
|
<input type="password" name="pw" placeholder="Passwort" autofocus required>
|
|
|
<button type="submit" name="login_auth">Einloggen</button>
|
|
|
@@ -53,6 +51,7 @@ if ($show_login):
|
|
|
$msg = "";
|
|
|
$msg_type = "success";
|
|
|
|
|
|
+// Spiel hinzufügen
|
|
|
if (isset($_POST['add_new_game'])) {
|
|
|
$ean = trim($_POST['new_ean']);
|
|
|
$titel = trim($_POST['new_titel']);
|
|
|
@@ -72,19 +71,35 @@ if (isset($_POST['add_new_game'])) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+// Spiel updaten
|
|
|
if (isset($_POST['update_game'])) {
|
|
|
$stmt = $pdo->prepare("UPDATE spiele SET titel = ?, typ_id = ?, ean = ?, level = ?, bild_url = ? WHERE id = ?");
|
|
|
- $stmt->execute([$_POST['titel'], ($_POST['typ_id'] == '0' ? null : (int)$_POST['typ_id']), $_POST['ean'], $_POST['level'], $_POST['bild_url'], (int)$_POST['spiel_id']]);
|
|
|
+ $stmt->execute([
|
|
|
+ $_POST['titel'],
|
|
|
+ ($_POST['typ_id'] == '0' ? null : (int)$_POST['typ_id']),
|
|
|
+ $_POST['ean'],
|
|
|
+ $_POST['level'],
|
|
|
+ $_POST['bild_url'],
|
|
|
+ (int)$_POST['spiel_id']
|
|
|
+ ]);
|
|
|
$msg = "💾 Änderungen gespeichert!";
|
|
|
}
|
|
|
|
|
|
+// Spiel löschen
|
|
|
if (isset($_POST['delete_game'])) {
|
|
|
$pdo->prepare("DELETE FROM spiele WHERE id = ?")->execute([(int)$_POST['spiel_id']]);
|
|
|
$msg = "🗑 Spiel gelöscht!";
|
|
|
}
|
|
|
|
|
|
+// Spieler löschen
|
|
|
+if (isset($_POST['delete_player'])) {
|
|
|
+ $pdo->prepare("DELETE FROM spieler WHERE id = ?")->execute([(int)$_POST['player_id']]);
|
|
|
+ $msg = "👤 Spieler/Team gelöscht!";
|
|
|
+}
|
|
|
+
|
|
|
$spiele = $pdo->query("SELECT s.*, t.bezeichnung as typ_name FROM spiele s LEFT JOIN game_typen t ON s.typ_id = t.id ORDER BY s.id DESC")->fetchAll();
|
|
|
$typen = $pdo->query("SELECT * FROM game_typen ORDER BY bezeichnung ASC")->fetchAll();
|
|
|
+$spieler = $pdo->query("SELECT * FROM spieler ORDER BY name ASC")->fetchAll();
|
|
|
?>
|
|
|
|
|
|
<!DOCTYPE html>
|
|
|
@@ -93,9 +108,8 @@ $typen = $pdo->query("SELECT * FROM game_typen ORDER BY bezeichnung ASC")->fetch
|
|
|
<meta charset="UTF-8">
|
|
|
<title>EXIT Admin - Stammdaten</title>
|
|
|
<style>
|
|
|
- /* THEME VARIABLEN */
|
|
|
:root {
|
|
|
- --bg: #f4f7f6; --card: #ffffff; --text: #333; --border: #ddd;
|
|
|
+ --bg: #f4f7f6; --card: #ffffff; --text: #333; --border: #ddd; --accent: #e67e22;
|
|
|
--header-bg: #f8f9fa; --input-bg: #fff; --unknown-bg: #fff3e0;
|
|
|
}
|
|
|
.dark-theme {
|
|
|
@@ -103,53 +117,47 @@ $typen = $pdo->query("SELECT * FROM game_typen ORDER BY bezeichnung ASC")->fetch
|
|
|
--header-bg: #252525; --input-bg: #2a2a2a; --unknown-bg: #4d2b00;
|
|
|
}
|
|
|
|
|
|
- body { font-family: 'Segoe UI', sans-serif; background: var(--bg); color: var(--text); padding: 20px; scroll-behavior: smooth; transition: background 0.3s, color 0.3s; }
|
|
|
- .container { max-width: 1400px; margin: 0 auto; position: relative; }
|
|
|
+ body { font-family: 'Segoe UI', sans-serif; background: var(--bg); color: var(--text); padding: 20px; transition: 0.3s; }
|
|
|
+ .container { max-width: 1500px; margin: 0 auto; }
|
|
|
|
|
|
- /* Theme Switcher Button */
|
|
|
- .theme-toggle { background: var(--card); border: 1px solid var(--border); color: var(--text); padding: 8px 12px; border-radius: 20px; cursor: pointer; font-size: 1.2rem; margin-right: 10px; transition: 0.3s; }
|
|
|
- .theme-toggle:hover { transform: scale(1.1); }
|
|
|
+ .tab-nav { display: flex; gap: 10px; margin-bottom: 20px; border-bottom: 2px solid var(--border); padding-bottom: 10px; }
|
|
|
+ .tab-btn { padding: 10px 20px; border: none; background: none; color: var(--text); cursor: pointer; font-weight: bold; border-radius: 8px; transition: 0.2s; }
|
|
|
+ .tab-btn.active { background: var(--accent); color: white; }
|
|
|
+ .tab-content { display: none; }
|
|
|
+ .tab-content.active { display: block; }
|
|
|
|
|
|
- /* Admin Layout */
|
|
|
- .alert { padding: 15px; border-radius: 8px; margin-bottom: 20px; font-weight: bold; text-align: center; position: sticky; top: 10px; z-index: 1000; border: 1px solid transparent; }
|
|
|
+ .admin-card { background: var(--card); padding: 20px; border-radius: 12px; box-shadow: 0 4px 15px rgba(0,0,0,0.1); margin-bottom: 30px; border: 1px solid var(--border); }
|
|
|
+ .alert { padding: 15px; border-radius: 8px; margin-bottom: 20px; font-weight: bold; text-align: center; border: 1px solid transparent; }
|
|
|
.alert-success { background: #d4edda; color: #155724; border-color: #c3e6cb; }
|
|
|
.dark-theme .alert-success { background: #1b4332; color: #74c69d; }
|
|
|
|
|
|
- .admin-card { background: var(--card); padding: 20px; border-radius: 12px; box-shadow: 0 4px 15px rgba(0,0,0,0.1); margin-bottom: 30px; border: 1px solid var(--border); }
|
|
|
- table { width: 100%; border-collapse: collapse; margin-top: 20px; table-layout: fixed; background: var(--card); }
|
|
|
- th { background: var(--header-bg); color: var(--text); padding: 12px 10px; text-align: left; font-size: 0.85em; text-transform: uppercase; border-bottom: 2px solid var(--border); }
|
|
|
+ table { width: 100%; border-collapse: collapse; margin-top: 10px; background: var(--card); }
|
|
|
+ th { background: var(--header-bg); padding: 12px; text-align: left; font-size: 0.85em; border-bottom: 2px solid var(--border); }
|
|
|
td { padding: 10px; border-bottom: 1px solid var(--border); }
|
|
|
|
|
|
- input, select { padding: 8px; border: 1px solid var(--border); border-radius: 6px; width: 100%; box-sizing: border-box; background: var(--input-bg); color: var(--text); font-size: 0.95em; }
|
|
|
-
|
|
|
- /* Spaltenbreiten */
|
|
|
- .col-img { width: 60px; } .col-titel { width: auto; } .col-ean { width: 130px; } .col-typ { width: 160px; } .col-lvl { width: 150px; } .col-url { width: 180px; } .col-akt { width: 100px; text-align: center; }
|
|
|
-
|
|
|
- .lvl-unknown { background: var(--unknown-bg) !important; color: #e67e22 !important; }
|
|
|
+ input, select { padding: 8px; border: 1px solid var(--border); border-radius: 6px; background: var(--input-bg); color: var(--text); width: 100%; box-sizing: border-box; }
|
|
|
|
|
|
- .btn { padding: 10px 15px; border: none; border-radius: 6px; cursor: pointer; font-weight: bold; color: white; text-decoration: none; display: inline-block; font-size: 0.9em; }
|
|
|
- .btn-add { background: #27ae60; width: 100%; margin-top: 10px; }
|
|
|
+ .btn { padding: 10px 15px; border: none; border-radius: 6px; cursor: pointer; font-weight: bold; color: white; text-decoration: none; display: inline-block; }
|
|
|
+ .btn-add { background: #27ae60; margin-top: 10px; width: 100%; }
|
|
|
.btn-save { background: #2980b9; }
|
|
|
.btn-del { background: #c0392b; }
|
|
|
- .btn-nav { background: #e67e22; }
|
|
|
+ .btn-nav { background: var(--accent); }
|
|
|
+
|
|
|
+ .img-preview { width: 40px; height: 40px; object-fit: cover; border-radius: 4px; }
|
|
|
+ .lvl-unknown { background: var(--unknown-bg) !important; color: #e67e22 !important; }
|
|
|
|
|
|
- #scrollToTop { position: fixed; bottom: 30px; right: 30px; background: #e67e22; color: white; width: 45px; height: 45px; border-radius: 50%; border: none; cursor: pointer; display: none; z-index: 1000; box-shadow: 0 4px 10px rgba(0,0,0,0.2); }
|
|
|
- .img-preview { width: 40px; height: 40px; object-fit: cover; border-radius: 4px; border: 1px solid var(--border); background: #eee; }
|
|
|
+ #scrollToTop { position: fixed; bottom: 30px; right: 30px; background: var(--accent); color: white; width: 45px; height: 45px; border-radius: 50%; border: none; cursor: pointer; display: none; }
|
|
|
</style>
|
|
|
- <script>
|
|
|
- // Theme sofort beim Laden anwenden (verhindert weißes Flackern)
|
|
|
- if (localStorage.getItem('theme') === 'dark') document.documentElement.classList.add('dark-theme');
|
|
|
- </script>
|
|
|
</head>
|
|
|
-<body id="top">
|
|
|
+<body>
|
|
|
|
|
|
<div class="container">
|
|
|
<div style="display:flex; justify-content: space-between; align-items: center; margin-bottom: 20px;">
|
|
|
- <h1>🛠 Stammdaten</h1>
|
|
|
- <div style="display: flex; align-items: center;">
|
|
|
- <button onclick="toggleTheme()" class="theme-toggle" id="theme-icon">🌙</button>
|
|
|
+ <h1>🛠 Admin-Bereich</h1>
|
|
|
+ <div style="display: flex; align-items: center; gap: 10px;">
|
|
|
+ <button onclick="toggleTheme()" class="theme-toggle" style="background:none; border:none; font-size:1.5rem; cursor:pointer;" id="theme-icon">🌙</button>
|
|
|
<a href="index.php" class="btn btn-nav">Dashboard</a>
|
|
|
- <a href="admin.php?logout=1" class="btn btn-del" style="margin-left:15px;">Logout</a>
|
|
|
+ <a href="admin.php?logout=1" class="btn btn-del">Logout</a>
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
@@ -157,108 +165,146 @@ $typen = $pdo->query("SELECT * FROM game_typen ORDER BY bezeichnung ASC")->fetch
|
|
|
<div class="alert alert-<?= $msg_type ?>" id="msg-box"><?= $msg ?></div>
|
|
|
<?php endif; ?>
|
|
|
|
|
|
- <div class="admin-card">
|
|
|
- <h3>🆕 Neues Spiel hinzufügen</h3>
|
|
|
- <form method="POST">
|
|
|
- <div style="display: grid; grid-template-columns: 3fr 1fr 1.2fr 1.2fr 2fr; gap: 10px;">
|
|
|
- <input type="text" name="new_titel" placeholder="Spieltitel" required>
|
|
|
- <input type="text" name="new_ean" placeholder="EAN" required>
|
|
|
- <select name="new_typ_id">
|
|
|
- <option value="0">-- Typ: Unbekannt --</option>
|
|
|
- <?php foreach($typen as $t): ?>
|
|
|
- <option value="<?= $t['id'] ?>"><?= htmlspecialchars($t['bezeichnung']) ?></option>
|
|
|
+ <div class="tab-nav">
|
|
|
+ <button class="tab-btn active" onclick="openTab(event, 'games')">🎮 Spiele verwalten</button>
|
|
|
+ <button class="tab-btn" onclick="openTab(event, 'players')">👥 Spieler / Teams</button>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div id="games" class="tab-content active">
|
|
|
+ <div class="admin-card">
|
|
|
+ <h3>🆕 Neues Spiel hinzufügen</h3>
|
|
|
+ <form method="POST">
|
|
|
+ <div style="display: grid; grid-template-columns: 2fr 1fr 1fr 1fr 2fr; gap: 10px;">
|
|
|
+ <input type="text" name="new_titel" placeholder="Spieltitel" required>
|
|
|
+ <input type="text" name="new_ean" placeholder="EAN" required>
|
|
|
+ <select name="new_typ_id">
|
|
|
+ <option value="0">-- Typ: Unbekannt --</option>
|
|
|
+ <?php foreach($typen as $t): ?><option value="<?= $t['id'] ?>"><?= htmlspecialchars($t['bezeichnung']) ?></option><?php endforeach; ?>
|
|
|
+ </select>
|
|
|
+ <select name="new_level">
|
|
|
+ <option value="Unknown">-- Level: Unbekannt --</option>
|
|
|
+ <option value="Einsteiger">Einsteiger</option>
|
|
|
+ <option value="Fortgeschrittene">Fortgeschrittene</option>
|
|
|
+ <option value="Profi">Profi</option>
|
|
|
+ </select>
|
|
|
+ <input type="text" name="new_bild_url" placeholder="Bild-URL">
|
|
|
+ </div>
|
|
|
+ <button type="submit" name="add_new_game" class="btn btn-add">In Datenbank speichern</button>
|
|
|
+ </form>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div class="admin-card" style="padding:0; overflow-x:auto;">
|
|
|
+ <table>
|
|
|
+ <thead>
|
|
|
+ <tr>
|
|
|
+ <th style="width:50px;">Bild</th>
|
|
|
+ <th>Titel</th>
|
|
|
+ <th style="width:120px;">EAN</th>
|
|
|
+ <th style="width:140px;">Typ</th>
|
|
|
+ <th style="width:140px;">Level</th>
|
|
|
+ <th style="width:200px;">Bild-URL</th>
|
|
|
+ <th style="width:90px;">Aktion</th>
|
|
|
+ </tr>
|
|
|
+ </thead>
|
|
|
+ <tbody>
|
|
|
+ <?php foreach ($spiele as $sp): $is_unknown = ($sp['level'] == 'Unknown' || empty($sp['level'])); ?>
|
|
|
+ <tr>
|
|
|
+ <form method="POST">
|
|
|
+ <input type="hidden" name="spiel_id" value="<?= $sp['id'] ?>">
|
|
|
+ <td><img src="<?= htmlspecialchars($sp['bild_url']) ?>" class="img-preview" onerror="this.src='https://via.placeholder.com/40?text=?';"></td>
|
|
|
+ <td><input type="text" name="titel" value="<?= htmlspecialchars($sp['titel']) ?>"></td>
|
|
|
+ <td><input type="text" name="ean" value="<?= htmlspecialchars($sp['ean']) ?>"></td>
|
|
|
+ <td>
|
|
|
+ <select name="typ_id">
|
|
|
+ <option value="0">Unbekannt</option>
|
|
|
+ <?php foreach($typen as $t): ?>
|
|
|
+ <option value="<?= $t['id'] ?>" <?= ($sp['typ_id']==$t['id'])?'selected':'' ?>><?= htmlspecialchars($t['bezeichnung']) ?></option>
|
|
|
+ <?php endforeach; ?>
|
|
|
+ </select>
|
|
|
+ </td>
|
|
|
+ <td>
|
|
|
+ <select name="level" class="<?= $is_unknown ? 'lvl-unknown' : '' ?>">
|
|
|
+ <option value="Unknown" <?= $is_unknown ? 'selected' : '' ?>>Unbekannt</option>
|
|
|
+ <option value="Einsteiger" <?= $sp['level']=='Einsteiger'?'selected':'' ?>>Einsteiger</option>
|
|
|
+ <option value="Fortgeschrittene" <?= $sp['level']=='Fortgeschrittene'?'selected':'' ?>>Fortgeschrittene</option>
|
|
|
+ <option value="Profi" <?= $sp['level']=='Profi'?'selected':'' ?>>Profi</option>
|
|
|
+ </select>
|
|
|
+ </td>
|
|
|
+ <td><input type="text" name="bild_url" value="<?= htmlspecialchars($sp['bild_url']) ?>"></td>
|
|
|
+ <td>
|
|
|
+ <button type="submit" name="update_game" class="btn btn-save">💾</button>
|
|
|
+ <button type="submit" name="delete_game" class="btn btn-del" onclick="return confirm('Löschen?')">🗑</button>
|
|
|
+ </td>
|
|
|
+ </form>
|
|
|
+ </tr>
|
|
|
<?php endforeach; ?>
|
|
|
- </select>
|
|
|
- <select name="new_level">
|
|
|
- <option value="Unknown" selected>-- Level: Unbekannt --</option>
|
|
|
- <option value="Einsteiger">Einsteiger</option>
|
|
|
- <option value="Fortgeschrittene">Fortgeschrittene</option>
|
|
|
- <option value="Profi">Profi</option>
|
|
|
- </select>
|
|
|
- <input type="text" name="new_bild_url" placeholder="Bild-URL">
|
|
|
- </div>
|
|
|
- <button type="submit" name="add_new_game" class="btn btn-add">In Datenbank speichern</button>
|
|
|
- </form>
|
|
|
+ </tbody>
|
|
|
+ </table>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
|
|
|
- <div class="admin-card" style="padding: 0; overflow: hidden;">
|
|
|
- <table id="bestand-table">
|
|
|
- <thead>
|
|
|
- <tr>
|
|
|
- <th class="col-img">Bild</th>
|
|
|
- <th class="col-titel">Titel</th>
|
|
|
- <th class="col-ean">EAN</th>
|
|
|
- <th class="col-typ">Typ</th>
|
|
|
- <th class="col-lvl">Level</th>
|
|
|
- <th class="col-url">Bild-URL</th>
|
|
|
- <th class="col-akt">Aktion</th>
|
|
|
- </tr>
|
|
|
- </thead>
|
|
|
- <tbody>
|
|
|
- <?php foreach ($spiele as $sp):
|
|
|
- $is_unknown = ($sp['level'] == 'Unknown' || empty($sp['level']));
|
|
|
- ?>
|
|
|
- <tr>
|
|
|
- <form method="POST">
|
|
|
- <input type="hidden" name="spiel_id" value="<?= $sp['id'] ?>">
|
|
|
- <td class="col-img"><img src="<?= htmlspecialchars($sp['bild_url']) ?>" class="img-preview" alt="Cover" onerror="this.src='https://via.placeholder.com/40?text=?';"></td>
|
|
|
- <td class="col-titel"><input type="text" name="titel" value="<?= htmlspecialchars($sp['titel']) ?>"></td>
|
|
|
- <td class="col-ean"><input type="text" name="ean" value="<?= htmlspecialchars($sp['ean']) ?>"></td>
|
|
|
- <td class="col-typ">
|
|
|
- <select name="typ_id">
|
|
|
- <option value="0">-- Unbekannt --</option>
|
|
|
- <?php foreach($typen as $t): ?>
|
|
|
- <option value="<?= $t['id'] ?>" <?= ($sp['typ_id']==$t['id'])?'selected':'' ?>><?= htmlspecialchars($t['bezeichnung']) ?></option>
|
|
|
- <?php endforeach; ?>
|
|
|
- </select>
|
|
|
- </td>
|
|
|
- <td class="col-lvl">
|
|
|
- <select name="level" class="<?= $is_unknown ? 'lvl-unknown' : '' ?>" onchange="this.className=this.value=='Unknown'?'lvl-unknown':''">
|
|
|
- <option value="Unknown" <?= $is_unknown ? 'selected' : '' ?>>Unbekannt</option>
|
|
|
- <option value="Einsteiger" <?= $sp['level']=='Einsteiger'?'selected':'' ?>>Einsteiger</option>
|
|
|
- <option value="Fortgeschrittene" <?= $sp['level']=='Fortgeschrittene'?'selected':'' ?>>Fortgeschrittene</option>
|
|
|
- <option value="Profi" <?= $sp['level']=='Profi'?'selected':'' ?>>Profi</option>
|
|
|
- </select>
|
|
|
+ <div id="players" class="tab-content">
|
|
|
+ <div class="admin-card">
|
|
|
+ <h3>👥 Vorhandene Spieler / Teams</h3>
|
|
|
+ <table>
|
|
|
+ <thead>
|
|
|
+ <tr>
|
|
|
+ <th>ID</th>
|
|
|
+ <th>Name</th>
|
|
|
+ <th style="width:100px;">Aktion</th>
|
|
|
+ </tr>
|
|
|
+ </thead>
|
|
|
+ <tbody>
|
|
|
+ <?php foreach ($spieler as $p): ?>
|
|
|
+ <tr>
|
|
|
+ <td>#<?= $p['id'] ?></td>
|
|
|
+ <td><strong><?= htmlspecialchars($p['name']) ?></strong></td>
|
|
|
+ <td>
|
|
|
+ <form method="POST" onsubmit="return confirm('Diesen Spieler wirklich löschen?')">
|
|
|
+ <input type="hidden" name="player_id" value="<?= $p['id'] ?>">
|
|
|
+ <button type="submit" name="delete_player" class="btn btn-del">Löschen</button>
|
|
|
+ </form>
|
|
|
</td>
|
|
|
- <td class="col-url"><input type="text" name="bild_url" value="<?= htmlspecialchars($sp['bild_url']) ?>"></td>
|
|
|
- <td class="col-akt">
|
|
|
- <button type="submit" name="update_game" class="btn btn-save">💾</button>
|
|
|
- <button type="submit" name="delete_game" class="btn btn-del" onclick="return confirm('Löschen?')">🗑</button>
|
|
|
- </td>
|
|
|
- </form>
|
|
|
- </tr>
|
|
|
- <?php endforeach; ?>
|
|
|
- </tbody>
|
|
|
- </table>
|
|
|
+ </tr>
|
|
|
+ <?php endforeach; ?>
|
|
|
+ </tbody>
|
|
|
+ </table>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
<button id="scrollToTop" onclick="window.scrollTo(0,0);">▲</button>
|
|
|
|
|
|
<script>
|
|
|
- // THEME LOGIK
|
|
|
+ function openTab(evt, tabName) {
|
|
|
+ let i, content, btns;
|
|
|
+ content = document.getElementsByClassName("tab-content");
|
|
|
+ for (i = 0; i < content.length; i++) { content[i].classList.remove("active"); }
|
|
|
+ btns = document.getElementsByClassName("tab-btn");
|
|
|
+ for (i = 0; i < btns.length; i++) { btns[i].classList.remove("active"); }
|
|
|
+ document.getElementById(tabName).classList.add("active");
|
|
|
+ evt.currentTarget.classList.add("active");
|
|
|
+ }
|
|
|
+
|
|
|
+ const themeIcon = document.getElementById('theme-icon');
|
|
|
function toggleTheme() {
|
|
|
const isDark = document.documentElement.classList.toggle('dark-theme');
|
|
|
localStorage.setItem('theme', isDark ? 'dark' : 'light');
|
|
|
- document.getElementById('theme-icon').innerText = isDark ? '☀️' : '🌙';
|
|
|
+ themeIcon.innerText = isDark ? '☀️' : '🌙';
|
|
|
}
|
|
|
-
|
|
|
- // Icon beim Laden anpassen
|
|
|
if (localStorage.getItem('theme') === 'dark') {
|
|
|
- document.getElementById('theme-icon').innerText = '☀️';
|
|
|
+ document.documentElement.classList.add('dark-theme');
|
|
|
+ themeIcon.innerText = '☀️';
|
|
|
}
|
|
|
|
|
|
- // Alerts ausblenden
|
|
|
setTimeout(() => {
|
|
|
const msg = document.getElementById('msg-box');
|
|
|
if(msg) { msg.style.transition = 'opacity 0.5s'; msg.style.opacity = '0'; }
|
|
|
}, 3000);
|
|
|
|
|
|
- // Scroll Button
|
|
|
window.onscroll = function() {
|
|
|
document.getElementById("scrollToTop").style.display = (window.scrollY > 300) ? "block" : "none";
|
|
|
};
|
|
|
</script>
|
|
|
-
|
|
|
</body>
|
|
|
</html>
|