chore: html-joke-ticker in Ausgangszustand zurücksetzen + Protokoll eintragen
- jokes.html: Skelett wiederhergestellt (kein JS, kein CSS) - README.md: Aktueller-Stand-Abschnitt auf Startzustand korrigiert - PROTOKOLL.md: Demo-Ergebnisse vom Fr 29. Mai eingetragen (inkl. Hinweis auf Witz-Sprache und /patch-History-Bug) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
8f410ec8e7
commit
1479959cae
3 changed files with 26 additions and 189 deletions
|
|
@ -2,16 +2,29 @@
|
||||||
|
|
||||||
## Lauf 1
|
## Lauf 1
|
||||||
|
|
||||||
**Datum:**
|
**Datum:** Fr 29. Mai 2026
|
||||||
**Befehl:**
|
**Befehl:**
|
||||||
```
|
```
|
||||||
/optimize "Ergänze jokes.html ..." --no-tests
|
/optimize "Ergänze jokes.html um eine vollständige Witz-Anzeige:
|
||||||
|
- JavaScript-Array mit mind. 20 deutschen Witzen (inline, kein externes API)
|
||||||
|
- Beim Laden: sofort zufälliger Witz
|
||||||
|
- Automatischer Wechsel alle 60 Sekunden (setInterval)
|
||||||
|
- Sanfter Fade-Übergang (CSS-Transition)
|
||||||
|
- Anzeige: Index (3/20) und Countdown-Sekunden bis zum nächsten Witz
|
||||||
|
- Button 'Nächster Witz' zum manuellen Weiterblättern
|
||||||
|
Kein Framework, kein Build-Tool — reines HTML/CSS/JS." \
|
||||||
|
--no-tests
|
||||||
```
|
```
|
||||||
**Startzeit:**
|
**Startzeit:** Fr 29. Mai ~22:22 CEST 2026
|
||||||
**Endzeit:**
|
**Endzeit:** Fr 29. Mai ~22:30 CEST 2026
|
||||||
**Dauer (min):**
|
**Dauer (min):** ~8
|
||||||
**Runden:**
|
**Runden:** 1 (direkte Implementierung, direkt PASS)
|
||||||
**Endergebnis:** PASS / PASS WITH CONCERNS / SHIP / NO-SHIP
|
**Endergebnis:** PASS
|
||||||
**Besonderheiten / Beobachtungen:**
|
**Besonderheiten / Beobachtungen:**
|
||||||
|
25 Witze inline im JavaScript-Array. Alle 8 Anforderungs-Checks bestanden.
|
||||||
|
Hinweis: Die anfänglich generierten Witze waren ins Deutsche übersetzt und
|
||||||
|
dadurch nicht witzig — ersetzt durch englische Originalwitze.
|
||||||
|
Außerdem: /patch für grünen „Vorheriger Witz"-Button erzeugte den Button,
|
||||||
|
aber die Navigation war defekt (Off-by-one im History-Stack). Manuell korrigiert.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,12 @@
|
||||||
# HTML Witze-Ticker
|
# HTML Witze-Ticker
|
||||||
|
|
||||||
Vollständige Witz-Anzeige in einer einzigen HTML-Datei (reines HTML/CSS/JS).
|
Minimales HTML-Skelett — Struktur vorhanden, aber keine Logik.
|
||||||
|
Die Witz-Anzeige, der Timer und die Buttons fehlen noch vollständig.
|
||||||
|
|
||||||
## Aktueller Stand
|
## Aktueller Stand
|
||||||
|
|
||||||
```
|
```
|
||||||
jokes.html 25 Witze inline, Fade-Transition, 60s-Autotimer, Index + Countdown, "Nächster Witz"-Button
|
jokes.html HTML-Skelett: <h1> + leeres <div id="joke"> — kein JavaScript, kein CSS
|
||||||
```
|
```
|
||||||
|
|
||||||
## Demo: `/optimize --no-tests`
|
## Demo: `/optimize --no-tests`
|
||||||
|
|
|
||||||
|
|
@ -2,187 +2,10 @@
|
||||||
<html lang="de">
|
<html lang="de">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
||||||
<title>Witze-Ticker</title>
|
<title>Witze-Ticker</title>
|
||||||
<script src="https://cdn.tailwindcss.com"></script>
|
|
||||||
<style>
|
|
||||||
/* Fade-Transition (wird per JS .fade-out Klasse getoggelt) */
|
|
||||||
#joke { transition: opacity .5s ease; }
|
|
||||||
#joke.fade-out { opacity: 0; }
|
|
||||||
</style>
|
|
||||||
</head>
|
</head>
|
||||||
<body class="min-h-screen flex items-center justify-center bg-stone-100 text-zinc-900 font-sans antialiased p-4 sm:p-8">
|
<body>
|
||||||
<div class="w-full max-w-[600px] bg-white rounded-2xl shadow-lg px-6 py-8 text-center">
|
<h1>Witze-Ticker</h1>
|
||||||
<h1 class="text-2xl font-bold mb-6">Witze-Ticker</h1>
|
<div id="joke"><!-- TODO: Witz hier --></div>
|
||||||
|
|
||||||
<div id="joke-container">
|
|
||||||
<div id="joke" class="text-lg sm:text-xl leading-relaxed min-h-[120px] flex items-center justify-center"></div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="mt-4 text-sm text-zinc-500 flex justify-center gap-5">
|
|
||||||
<span id="index-display"></span>
|
|
||||||
<span id="countdown-display"></span>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="mt-6 flex flex-col sm:flex-row items-center justify-center gap-3">
|
|
||||||
<button id="prev-btn" class="w-full sm:w-auto px-5 py-2.5 text-base rounded-lg bg-gray-500 text-white cursor-pointer transition-colors duration-200 hover:bg-gray-600 active:bg-gray-700">Vorheriger Witz</button>
|
|
||||||
<button id="next-btn" class="w-full sm:w-auto px-5 py-2.5 text-base rounded-lg bg-blue-600 text-white cursor-pointer transition-colors duration-200 hover:bg-blue-700 active:bg-blue-800">Nächster Witz</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
(function () {
|
|
||||||
'use strict';
|
|
||||||
|
|
||||||
var jokes = [
|
|
||||||
"Why don't scientists trust atoms? Because they make up everything.",
|
|
||||||
"I told my wife she was drawing her eyebrows too high. She looked surprised.",
|
|
||||||
"Why do programmers prefer dark mode? Because light attracts bugs.",
|
|
||||||
"I asked the librarian if they had books about paranoia. She whispered: 'They're right behind you.'",
|
|
||||||
"A skeleton walks into a bar and orders a beer \u2014 and a mop.",
|
|
||||||
"Why did the scarecrow win an award? Because he was outstanding in his field.",
|
|
||||||
"I'm reading a book about anti-gravity. It's impossible to put down.",
|
|
||||||
"Why do cows wear bells? Because their horns don't work.",
|
|
||||||
"I told my dog he was adopted. He said: 'I knew it \u2014 you throw like a human.'",
|
|
||||||
"What do you call a fish without eyes? A fsh.",
|
|
||||||
"Why can't you trust stairs? They're always up to something.",
|
|
||||||
"I used to hate facial hair, but then it grew on me.",
|
|
||||||
"Why did the bicycle fall over? Because it was two-tired.",
|
|
||||||
"What do you call cheese that isn't yours? Nacho cheese.",
|
|
||||||
"I tried to write a joke about clocks but it was time-consuming.",
|
|
||||||
"Why did the math book look so sad? It had too many problems.",
|
|
||||||
"What do you call a sleeping dinosaur? A dino-snore.",
|
|
||||||
"I told my cat a joke. He didn't laugh. Tough crowd.",
|
|
||||||
"Why don't eggs tell jokes? They'd crack each other up.",
|
|
||||||
"What's a vampire's favourite fruit? A blood orange. Just kidding \u2014 neck-tarines.",
|
|
||||||
"Why did the coffee file a police report? It got mugged.",
|
|
||||||
"I asked my dog what two minus two is. He said nothing.",
|
|
||||||
"What do you call a fake noodle? An impasta.",
|
|
||||||
"Why did the golfer bring an extra pair of trousers? In case he got a hole in one.",
|
|
||||||
"I have a joke about construction, but I'm still working on it."
|
|
||||||
];
|
|
||||||
|
|
||||||
var COUNTDOWN_SECONDS = 60;
|
|
||||||
var currentIndex = -1;
|
|
||||||
var countdownSeconds = COUNTDOWN_SECONDS;
|
|
||||||
var fadeTimeout = null;
|
|
||||||
var countdownInterval = null;
|
|
||||||
var jokeHistory = []; // joke indices in visit order
|
|
||||||
var historyPos = -1; // current position in jokeHistory
|
|
||||||
|
|
||||||
var jokeEl = document.getElementById('joke');
|
|
||||||
var indexEl = document.getElementById('index-display');
|
|
||||||
var countdownEl = document.getElementById('countdown-display');
|
|
||||||
var nextBtn = document.getElementById('next-btn');
|
|
||||||
var prevBtn = document.getElementById('prev-btn');
|
|
||||||
|
|
||||||
// Zuf\u00e4lligen Index w\u00e4hlen (nicht derselbe wie der aktuelle)
|
|
||||||
function randomIndex() {
|
|
||||||
var idx;
|
|
||||||
do { idx = Math.floor(Math.random() * jokes.length); }
|
|
||||||
while (idx === currentIndex && jokes.length > 1);
|
|
||||||
return idx;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Witz anzeigen mit Fade-\u00dcbergang
|
|
||||||
function showJoke(idx) {
|
|
||||||
clearTimeout(fadeTimeout);
|
|
||||||
currentIndex = idx;
|
|
||||||
jokeEl.classList.add('fade-out');
|
|
||||||
|
|
||||||
fadeTimeout = setTimeout(function () {
|
|
||||||
jokeEl.textContent = jokes[idx];
|
|
||||||
indexEl.textContent = (idx + 1) + '/' + jokes.length;
|
|
||||||
jokeEl.classList.remove('fade-out');
|
|
||||||
}, 500);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Vorherigen Witz anzeigen
|
|
||||||
function prevJoke() {
|
|
||||||
if (historyPos <= 0) return;
|
|
||||||
historyPos--;
|
|
||||||
showJoke(jokeHistory[historyPos]);
|
|
||||||
startCountdown();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Countdown-Anzeige aktualisieren
|
|
||||||
function updateCountdownDisplay() {
|
|
||||||
countdownEl.textContent = 'N\u00e4chster Witz in ' + countdownSeconds + ' s';
|
|
||||||
}
|
|
||||||
|
|
||||||
// Countdown starten (ein einziger Timer \u2014 bei 0 wird nextJoke aufgerufen)
|
|
||||||
function startCountdown() {
|
|
||||||
countdownSeconds = COUNTDOWN_SECONDS;
|
|
||||||
updateCountdownDisplay();
|
|
||||||
|
|
||||||
clearInterval(countdownInterval);
|
|
||||||
countdownInterval = setInterval(function () {
|
|
||||||
countdownSeconds--;
|
|
||||||
if (countdownSeconds <= 0) {
|
|
||||||
clearInterval(countdownInterval);
|
|
||||||
countdownSeconds = 0;
|
|
||||||
updateCountdownDisplay();
|
|
||||||
nextJoke();
|
|
||||||
} else {
|
|
||||||
updateCountdownDisplay();
|
|
||||||
}
|
|
||||||
}, 1000);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Countdown pausieren (Tab in Hintergrund)
|
|
||||||
function pauseCountdown() {
|
|
||||||
clearInterval(countdownInterval);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Countdown fortsetzen (Tab wieder aktiv)
|
|
||||||
function resumeCountdown() {
|
|
||||||
if (countdownSeconds > 0) {
|
|
||||||
startCountdown();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// N\u00e4chsten Witz zeigen (manuell oder automatisch)
|
|
||||||
function nextJoke() {
|
|
||||||
// Vorw\u00e4rts-History verwerfen, neuen Witz anh\u00e4ngen
|
|
||||||
jokeHistory.splice(historyPos + 1);
|
|
||||||
var idx = randomIndex();
|
|
||||||
jokeHistory.push(idx);
|
|
||||||
historyPos = jokeHistory.length - 1;
|
|
||||||
showJoke(idx);
|
|
||||||
startCountdown();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Initialer Zufallswitz beim Laden
|
|
||||||
function init() {
|
|
||||||
var idx = Math.floor(Math.random() * jokes.length);
|
|
||||||
currentIndex = idx;
|
|
||||||
jokeHistory.push(idx);
|
|
||||||
historyPos = 0;
|
|
||||||
jokeEl.textContent = jokes[idx];
|
|
||||||
indexEl.textContent = (idx + 1) + '/' + jokes.length;
|
|
||||||
startCountdown();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Event-Listener
|
|
||||||
nextBtn.addEventListener('click', function () {
|
|
||||||
nextJoke();
|
|
||||||
});
|
|
||||||
|
|
||||||
prevBtn.addEventListener('click', function () {
|
|
||||||
prevJoke();
|
|
||||||
});
|
|
||||||
|
|
||||||
document.addEventListener('visibilitychange', function () {
|
|
||||||
if (document.hidden) {
|
|
||||||
pauseCountdown();
|
|
||||||
} else {
|
|
||||||
resumeCountdown();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// Start
|
|
||||||
init();
|
|
||||||
})();
|
|
||||||
</script>
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue