Frontend: CSS auf allgemeine Klassen verschlankt (82 Zeilen)
- ID-Selektoren (#account-info, #delete-form button) und verschachtelte
Selektoren (.entry .meta, .interactions .vote) entfernt
- wiederverwendbare Klassen: .card, .muted, .row, .ghost
- globale a/h1/h2-Regeln, Farben als CSS-Variablen (--border, --danger)
- HTML/JS synchron umgestellt; counts-Span via querySelector("span")
- Cross-Check: keine toten CSS-Klassen, keine unbekannten Referenzen
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
+33
-54
@@ -4,6 +4,8 @@
|
|||||||
--fg: #e8e8e8;
|
--fg: #e8e8e8;
|
||||||
--muted: #9aa0a6;
|
--muted: #9aa0a6;
|
||||||
--accent: #4a9eff;
|
--accent: #4a9eff;
|
||||||
|
--border: #2a2e35;
|
||||||
|
--danger: #c0392b;
|
||||||
}
|
}
|
||||||
|
|
||||||
* { box-sizing: border-box; }
|
* { box-sizing: border-box; }
|
||||||
@@ -15,89 +17,66 @@ body {
|
|||||||
color: var(--fg);
|
color: var(--fg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
a { color: var(--accent); }
|
||||||
|
h1 { margin: 0; font-size: 1.4rem; }
|
||||||
|
h2 { margin: 0 0 0.8rem; font-size: 1.1rem; }
|
||||||
|
|
||||||
header {
|
header {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
padding: 1rem 1.5rem;
|
padding: 1rem 1.5rem;
|
||||||
border-bottom: 1px solid #2a2e35;
|
background: var(--bg);
|
||||||
|
border-bottom: 1px solid var(--border);
|
||||||
position: sticky;
|
position: sticky;
|
||||||
top: 0;
|
top: 0;
|
||||||
background: var(--bg);
|
|
||||||
}
|
|
||||||
|
|
||||||
header h1 { margin: 0; font-size: 1.4rem; }
|
|
||||||
|
|
||||||
main {
|
|
||||||
max-width: 600px;
|
|
||||||
margin: 0 auto;
|
|
||||||
padding: 1rem;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
main { max-width: 600px; margin: 0 auto; padding: 1rem; }
|
||||||
section { margin-bottom: 1.5rem; }
|
section { margin-bottom: 1.5rem; }
|
||||||
|
|
||||||
input, textarea, button {
|
input, textarea, button {
|
||||||
font: inherit;
|
font: inherit;
|
||||||
border-radius: 6px;
|
|
||||||
border: 1px solid #2a2e35;
|
|
||||||
background: var(--card);
|
|
||||||
color: var(--fg);
|
|
||||||
padding: 0.6rem 0.8rem;
|
padding: 0.6rem 0.8rem;
|
||||||
|
color: var(--fg);
|
||||||
|
background: var(--card);
|
||||||
|
border: 1px solid var(--border);
|
||||||
|
border-radius: 6px;
|
||||||
}
|
}
|
||||||
|
|
||||||
input, textarea { width: 100%; margin-bottom: 0.6rem; }
|
input, textarea { width: 100%; margin-bottom: 0.6rem; }
|
||||||
textarea { min-height: 80px; resize: vertical; }
|
textarea { min-height: 80px; resize: vertical; }
|
||||||
|
|
||||||
button {
|
button {
|
||||||
|
width: auto;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
|
color: #fff;
|
||||||
background: var(--accent);
|
background: var(--accent);
|
||||||
border-color: var(--accent);
|
border-color: var(--accent);
|
||||||
color: #fff;
|
|
||||||
width: auto;
|
|
||||||
}
|
}
|
||||||
button:hover { opacity: 0.9; }
|
button:hover { opacity: 0.9; }
|
||||||
|
|
||||||
.entry {
|
.card {
|
||||||
background: var(--card);
|
|
||||||
border: 1px solid #2a2e35;
|
|
||||||
border-radius: 8px;
|
|
||||||
padding: 1rem;
|
padding: 1rem;
|
||||||
margin-bottom: 1rem;
|
margin-bottom: 1rem;
|
||||||
|
background: var(--card);
|
||||||
|
border: 1px solid var(--border);
|
||||||
|
border-radius: 8px;
|
||||||
}
|
}
|
||||||
|
.card img { max-width: 100%; margin-top: 0.6rem; border-radius: 6px; }
|
||||||
|
|
||||||
.entry .meta { color: var(--muted); font-size: 0.85rem; margin-bottom: 0.5rem; }
|
.muted { color: var(--muted); font-size: 0.9rem; }
|
||||||
.entry .content { white-space: pre-wrap; word-wrap: break-word; }
|
.content { margin-top: 0.5rem; white-space: pre-wrap; word-wrap: break-word; }
|
||||||
.entry img { max-width: 100%; border-radius: 6px; margin-top: 0.6rem; }
|
.msg { min-height: 1.2em; font-size: 0.9rem; color: #ff6b6b; }
|
||||||
|
.end { text-align: center; padding: 2rem 0; }
|
||||||
|
|
||||||
.entry a { color: var(--accent); }
|
.row { display: flex; align-items: center; gap: 0.75rem; margin-top: 0.8rem; }
|
||||||
|
.ghost {
|
||||||
.msg { color: #ff6b6b; font-size: 0.9rem; min-height: 1.2em; }
|
|
||||||
.switch { color: var(--muted); font-size: 0.9rem; margin: 0.6rem 0 0; }
|
|
||||||
.switch a { color: var(--accent); }
|
|
||||||
|
|
||||||
#account-info { color: var(--muted); font-size: 0.9rem; }
|
|
||||||
.danger summary { cursor: pointer; color: #ff6b6b; font-size: 0.9rem; }
|
|
||||||
.danger form { margin-top: 0.6rem; }
|
|
||||||
.danger p { color: var(--muted); font-size: 0.85rem; }
|
|
||||||
#delete-form button { background: #c0392b; border-color: #c0392b; }
|
|
||||||
.end { text-align: center; color: var(--muted); padding: 2rem 0; }
|
|
||||||
|
|
||||||
.interactions {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
gap: 0.75rem;
|
|
||||||
margin-top: 0.8rem;
|
|
||||||
}
|
|
||||||
.interactions .vote {
|
|
||||||
background: transparent;
|
|
||||||
border: 1px solid #2a2e35;
|
|
||||||
color: var(--fg);
|
color: var(--fg);
|
||||||
|
background: transparent;
|
||||||
|
border-color: var(--border);
|
||||||
padding: 0.3rem 0.7rem;
|
padding: 0.3rem 0.7rem;
|
||||||
}
|
}
|
||||||
.interactions .vote:hover { border-color: var(--accent); }
|
.ghost:hover { border-color: var(--accent); }
|
||||||
.interactions .vote.selected {
|
.ghost.selected { color: #fff; background: var(--accent); border-color: var(--accent); }
|
||||||
background: var(--accent);
|
|
||||||
border-color: var(--accent);
|
.danger summary { cursor: pointer; color: #ff6b6b; }
|
||||||
color: #fff;
|
.danger button { background: var(--danger); border-color: var(--danger); }
|
||||||
}
|
|
||||||
.interactions .counts { color: var(--muted); font-size: 0.9rem; }
|
|
||||||
|
|||||||
+4
-4
@@ -21,7 +21,7 @@
|
|||||||
<input name="pass" type="password" placeholder="Passwort" autocomplete="current-password">
|
<input name="pass" type="password" placeholder="Passwort" autocomplete="current-password">
|
||||||
<input name="timeout" type="hidden" value="86400">
|
<input name="timeout" type="hidden" value="86400">
|
||||||
<button type="submit">Einloggen</button>
|
<button type="submit">Einloggen</button>
|
||||||
<p class="switch">Noch kein Konto? <a href="#" id="show-register">Registrieren</a></p>
|
<p class="muted">Noch kein Konto? <a href="#" id="show-register">Registrieren</a></p>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<form id="register-form" hidden>
|
<form id="register-form" hidden>
|
||||||
@@ -30,7 +30,7 @@
|
|||||||
<input name="pass1" type="password" placeholder="Passwort" autocomplete="new-password">
|
<input name="pass1" type="password" placeholder="Passwort" autocomplete="new-password">
|
||||||
<input name="pass2" type="password" placeholder="Passwort wiederholen" autocomplete="new-password">
|
<input name="pass2" type="password" placeholder="Passwort wiederholen" autocomplete="new-password">
|
||||||
<button type="submit">Konto erstellen</button>
|
<button type="submit">Konto erstellen</button>
|
||||||
<p class="switch">Schon registriert? <a href="#" id="show-login">Zum Login</a></p>
|
<p class="muted">Schon registriert? <a href="#" id="show-login">Zum Login</a></p>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<p class="msg" id="auth-msg"></p>
|
<p class="msg" id="auth-msg"></p>
|
||||||
@@ -48,11 +48,11 @@
|
|||||||
|
|
||||||
<!-- Konto -->
|
<!-- Konto -->
|
||||||
<section id="account" hidden>
|
<section id="account" hidden>
|
||||||
<p id="account-info"></p>
|
<p id="account-info" class="muted"></p>
|
||||||
<details class="danger">
|
<details class="danger">
|
||||||
<summary>Konto löschen</summary>
|
<summary>Konto löschen</summary>
|
||||||
<form id="delete-form">
|
<form id="delete-form">
|
||||||
<p>Löscht dein Konto samt Beiträgen und Votes unwiderruflich.</p>
|
<p class="muted">Löscht dein Konto samt Beiträgen und Votes unwiderruflich.</p>
|
||||||
<input name="pass1" type="password" placeholder="Passwort bestätigen" autocomplete="current-password">
|
<input name="pass1" type="password" placeholder="Passwort bestätigen" autocomplete="current-password">
|
||||||
<button type="submit">Konto endgültig löschen</button>
|
<button type="submit">Konto endgültig löschen</button>
|
||||||
</form>
|
</form>
|
||||||
|
|||||||
+10
-10
@@ -129,7 +129,7 @@ let done = false;
|
|||||||
|
|
||||||
function renderEntry(e) {
|
function renderEntry(e) {
|
||||||
const el = document.createElement("article");
|
const el = document.createElement("article");
|
||||||
el.className = "entry";
|
el.className = "card";
|
||||||
|
|
||||||
const when = new Date(e.created_at * 1000).toLocaleString("de-DE");
|
const when = new Date(e.created_at * 1000).toLocaleString("de-DE");
|
||||||
let media = "";
|
let media = "";
|
||||||
@@ -138,13 +138,13 @@ function renderEntry(e) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
el.innerHTML = `
|
el.innerHTML = `
|
||||||
<div class="meta"><strong>${escapeHtml(e.username)}</strong> · ${when}</div>
|
<div class="muted"><strong>${escapeHtml(e.username)}</strong> · ${when}</div>
|
||||||
<div class="content">${linkify(e.content)}</div>
|
<div class="content">${linkify(e.content)}</div>
|
||||||
${media}
|
${media}
|
||||||
<div class="interactions">
|
<div class="row">
|
||||||
<button class="vote" data-mode="left">Links</button>
|
<button class="ghost" data-mode="left">Links</button>
|
||||||
<span class="counts">– / –</span>
|
<span class="muted">– / –</span>
|
||||||
<button class="vote" data-mode="right">Rechts</button>
|
<button class="ghost" data-mode="right">Rechts</button>
|
||||||
</div>
|
</div>
|
||||||
`;
|
`;
|
||||||
setupVoting(el, e.pid);
|
setupVoting(el, e.pid);
|
||||||
@@ -152,9 +152,9 @@ function renderEntry(e) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function setupVoting(el, pid) {
|
function setupVoting(el, pid) {
|
||||||
const box = el.querySelector(".interactions");
|
const box = el.querySelector(".row");
|
||||||
const counts = box.querySelector(".counts");
|
const counts = box.querySelector("span");
|
||||||
const buttons = box.querySelectorAll(".vote");
|
const buttons = box.querySelectorAll(".ghost");
|
||||||
|
|
||||||
function render(state) {
|
function render(state) {
|
||||||
if (state.error) {
|
if (state.error) {
|
||||||
@@ -190,7 +190,7 @@ async function loadMore() {
|
|||||||
if (!entries.length) {
|
if (!entries.length) {
|
||||||
done = true;
|
done = true;
|
||||||
const end = document.createElement("p");
|
const end = document.createElement("p");
|
||||||
end.className = "end";
|
end.className = "muted end";
|
||||||
end.textContent = "YOU REACHED THE END!";
|
end.textContent = "YOU REACHED THE END!";
|
||||||
feed.appendChild(end);
|
feed.appendChild(end);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user