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:
+10
-10
@@ -129,7 +129,7 @@ let done = false;
|
||||
|
||||
function renderEntry(e) {
|
||||
const el = document.createElement("article");
|
||||
el.className = "entry";
|
||||
el.className = "card";
|
||||
|
||||
const when = new Date(e.created_at * 1000).toLocaleString("de-DE");
|
||||
let media = "";
|
||||
@@ -138,13 +138,13 @@ function renderEntry(e) {
|
||||
}
|
||||
|
||||
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>
|
||||
${media}
|
||||
<div class="interactions">
|
||||
<button class="vote" data-mode="left">Links</button>
|
||||
<span class="counts">– / –</span>
|
||||
<button class="vote" data-mode="right">Rechts</button>
|
||||
<div class="row">
|
||||
<button class="ghost" data-mode="left">Links</button>
|
||||
<span class="muted">– / –</span>
|
||||
<button class="ghost" data-mode="right">Rechts</button>
|
||||
</div>
|
||||
`;
|
||||
setupVoting(el, e.pid);
|
||||
@@ -152,9 +152,9 @@ function renderEntry(e) {
|
||||
}
|
||||
|
||||
function setupVoting(el, pid) {
|
||||
const box = el.querySelector(".interactions");
|
||||
const counts = box.querySelector(".counts");
|
||||
const buttons = box.querySelectorAll(".vote");
|
||||
const box = el.querySelector(".row");
|
||||
const counts = box.querySelector("span");
|
||||
const buttons = box.querySelectorAll(".ghost");
|
||||
|
||||
function render(state) {
|
||||
if (state.error) {
|
||||
@@ -190,7 +190,7 @@ async function loadMore() {
|
||||
if (!entries.length) {
|
||||
done = true;
|
||||
const end = document.createElement("p");
|
||||
end.className = "end";
|
||||
end.className = "muted end";
|
||||
end.textContent = "YOU REACHED THE END!";
|
||||
feed.appendChild(end);
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user