2026-06-11 21:55:47 +02:00
|
|
|
|
/* Formulare: Progressive Enhancement — ohne JS normales POST + Redirect.
|
|
|
|
|
|
Mit JS: Inline-Feldfehler (aria-describedby, Fokus aufs erste ungültige Feld),
|
|
|
|
|
|
fetch-Submit, Status in aria-live-Region, Button-Sperre während des Sendens. */
|
Neubau Fundament + Startseite: Designsystem, PHP-Komponenten, Brevo-Formular, Instagram-Sync
- Ordnerstruktur mit public/-Docroot, Deny-.htaccess für app/bin/config/data/storage
- CLAUDE.md mit Leitplanken (self-hosted only, Single Source of Truth, Component-first)
- Design-Tokens aus alter Seite extrahiert (Akzent #e20612, Coolvetica/Abel als woff2)
- Front Controller mit Routen-Register, Sitemap, Canonical, JSON-LD (SportsClub)
- Startseite: Hero, Instagram-Feed (lokaler Cache), Historie/Sportheim, Stats, Partner, Kontakt
- Kontaktformular via PHPMailer/Brevo mit Honeypot + HMAC-Time-Trap (kein reCAPTCHA)
- bin/instagram-sync.php: Scraper mit Strategie-Kette, flock, atomarem Cache, lokalen Bildern
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-11 21:16:25 +02:00
|
|
|
|
(function () {
|
|
|
|
|
|
'use strict';
|
|
|
|
|
|
|
|
|
|
|
|
var form = document.querySelector('.form');
|
|
|
|
|
|
if (!form || !window.fetch) {
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
var status = form.querySelector('[data-form-status]');
|
|
|
|
|
|
var button = form.querySelector('button[type="submit"]');
|
|
|
|
|
|
|
|
|
|
|
|
var MESSAGES = {
|
|
|
|
|
|
success: 'Danke für deine Anfrage! Wir melden uns so schnell wie möglich bei dir.',
|
|
|
|
|
|
validation: 'Bitte prüfe deine Eingaben – Pflichtfelder fehlen oder die E-Mail-Adresse ist ungültig.',
|
2026-06-20 20:41:50 +02:00
|
|
|
|
ratelimit: 'Zu viele Anfragen in kurzer Zeit. Bitte versuche es in ein paar Minuten erneut.',
|
Neubau Fundament + Startseite: Designsystem, PHP-Komponenten, Brevo-Formular, Instagram-Sync
- Ordnerstruktur mit public/-Docroot, Deny-.htaccess für app/bin/config/data/storage
- CLAUDE.md mit Leitplanken (self-hosted only, Single Source of Truth, Component-first)
- Design-Tokens aus alter Seite extrahiert (Akzent #e20612, Coolvetica/Abel als woff2)
- Front Controller mit Routen-Register, Sitemap, Canonical, JSON-LD (SportsClub)
- Startseite: Hero, Instagram-Feed (lokaler Cache), Historie/Sportheim, Stats, Partner, Kontakt
- Kontaktformular via PHPMailer/Brevo mit Honeypot + HMAC-Time-Trap (kein reCAPTCHA)
- bin/instagram-sync.php: Scraper mit Strategie-Kette, flock, atomarem Cache, lokalen Bildern
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-11 21:16:25 +02:00
|
|
|
|
mail: 'Deine Nachricht konnte gerade nicht versendet werden. Bitte versuche es später erneut.'
|
|
|
|
|
|
};
|
|
|
|
|
|
|
2026-06-11 21:55:47 +02:00
|
|
|
|
function errorEl(field) {
|
|
|
|
|
|
return field.id ? document.getElementById(field.id + '-error') : null;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function showFieldError(field) {
|
|
|
|
|
|
var msg = errorEl(field);
|
|
|
|
|
|
field.setAttribute('aria-invalid', 'true');
|
|
|
|
|
|
if (msg) {
|
|
|
|
|
|
msg.textContent = field.validationMessage;
|
|
|
|
|
|
msg.hidden = false;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function clearFieldError(field) {
|
|
|
|
|
|
var msg = errorEl(field);
|
|
|
|
|
|
field.removeAttribute('aria-invalid');
|
|
|
|
|
|
if (msg) {
|
|
|
|
|
|
msg.textContent = '';
|
|
|
|
|
|
msg.hidden = true;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Array.prototype.forEach.call(form.elements, function (field) {
|
|
|
|
|
|
field.addEventListener('input', function () { clearFieldError(field); });
|
|
|
|
|
|
field.addEventListener('change', function () { clearFieldError(field); });
|
|
|
|
|
|
});
|
|
|
|
|
|
|
Neubau Fundament + Startseite: Designsystem, PHP-Komponenten, Brevo-Formular, Instagram-Sync
- Ordnerstruktur mit public/-Docroot, Deny-.htaccess für app/bin/config/data/storage
- CLAUDE.md mit Leitplanken (self-hosted only, Single Source of Truth, Component-first)
- Design-Tokens aus alter Seite extrahiert (Akzent #e20612, Coolvetica/Abel als woff2)
- Front Controller mit Routen-Register, Sitemap, Canonical, JSON-LD (SportsClub)
- Startseite: Hero, Instagram-Feed (lokaler Cache), Historie/Sportheim, Stats, Partner, Kontakt
- Kontaktformular via PHPMailer/Brevo mit Honeypot + HMAC-Time-Trap (kein reCAPTCHA)
- bin/instagram-sync.php: Scraper mit Strategie-Kette, flock, atomarem Cache, lokalen Bildern
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-11 21:16:25 +02:00
|
|
|
|
function show(type, text) {
|
|
|
|
|
|
var p = document.createElement('p');
|
|
|
|
|
|
p.className = type === 'success' ? 'form__success' : 'form__error';
|
|
|
|
|
|
p.textContent = text;
|
|
|
|
|
|
status.replaceChildren(p);
|
2026-06-11 21:55:47 +02:00
|
|
|
|
status.focus({ preventScroll: true });
|
Neubau Fundament + Startseite: Designsystem, PHP-Komponenten, Brevo-Formular, Instagram-Sync
- Ordnerstruktur mit public/-Docroot, Deny-.htaccess für app/bin/config/data/storage
- CLAUDE.md mit Leitplanken (self-hosted only, Single Source of Truth, Component-first)
- Design-Tokens aus alter Seite extrahiert (Akzent #e20612, Coolvetica/Abel als woff2)
- Front Controller mit Routen-Register, Sitemap, Canonical, JSON-LD (SportsClub)
- Startseite: Hero, Instagram-Feed (lokaler Cache), Historie/Sportheim, Stats, Partner, Kontakt
- Kontaktformular via PHPMailer/Brevo mit Honeypot + HMAC-Time-Trap (kein reCAPTCHA)
- bin/instagram-sync.php: Scraper mit Strategie-Kette, flock, atomarem Cache, lokalen Bildern
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-11 21:16:25 +02:00
|
|
|
|
status.scrollIntoView({ block: 'nearest', behavior: 'smooth' });
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
form.addEventListener('submit', function (event) {
|
|
|
|
|
|
if (!form.checkValidity()) {
|
|
|
|
|
|
event.preventDefault();
|
2026-06-11 21:55:47 +02:00
|
|
|
|
var invalid = form.querySelectorAll(':invalid');
|
|
|
|
|
|
Array.prototype.forEach.call(invalid, showFieldError);
|
|
|
|
|
|
if (invalid.length) {
|
|
|
|
|
|
invalid[0].focus();
|
|
|
|
|
|
}
|
Neubau Fundament + Startseite: Designsystem, PHP-Komponenten, Brevo-Formular, Instagram-Sync
- Ordnerstruktur mit public/-Docroot, Deny-.htaccess für app/bin/config/data/storage
- CLAUDE.md mit Leitplanken (self-hosted only, Single Source of Truth, Component-first)
- Design-Tokens aus alter Seite extrahiert (Akzent #e20612, Coolvetica/Abel als woff2)
- Front Controller mit Routen-Register, Sitemap, Canonical, JSON-LD (SportsClub)
- Startseite: Hero, Instagram-Feed (lokaler Cache), Historie/Sportheim, Stats, Partner, Kontakt
- Kontaktformular via PHPMailer/Brevo mit Honeypot + HMAC-Time-Trap (kein reCAPTCHA)
- bin/instagram-sync.php: Scraper mit Strategie-Kette, flock, atomarem Cache, lokalen Bildern
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-11 21:16:25 +02:00
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
event.preventDefault();
|
Feinschliff: Formulare neu, Glas global dunkler, Hero-Fade sauber
Formulare (form-field.php, 3 Form-Wrapper, components.css, form.js):
- Floating Labels (Label im Feld, wandert bei Fokus/Inhalt hoch; select/date
dauerhaft oben) via :has() + placeholder=" "-Trick. Echtes <label> bleibt
im DOM (kein Placeholder-als-Label).
- Globale "Pflichtfelder mit *"-Hinweiszeile entfernt; Stern bleibt am Feld,
pro Feld als visually-hidden "(Pflichtfeld)" für Screenreader erklärt.
- Markenroter Fokus-Ring statt Weiß.
- Felder als sanfter Füll-Look: weichere Ränder (eigene --clr-field-*-Tokens),
Erkennbarkeit über Fläche + Rand (WCAG 1.4.11 erfüllt).
- form.js: Submit-Button-Text wird je Formular korrekt wiederhergestellt.
Glas-Look global (tokens.css, components.css):
- Frosted Glass zentral: --glass-blur + --glass-shadow (Glow + Top-Sheen),
eine Regel statt 28× wiederholt; Leaf-Karten mit Blur, Container nur Glow
(kein Doppel-Frost). @supports-Fallback.
- Dunkleres Glas (--clr-glass-bg auf Schwarz-Tint), dezenter Card-Rand.
Hero-Fade (components.css):
- Unterer Auslauf nicht mehr mit grauem --clr-bg zugedeckt, sondern .hero__media
per mask-image ausgeblendet → echter dunkler, texturierter Hintergrund scheint
durch (schwärzer, durchsichtig, kein graues Band). Abdunklung auf reines
Schwarz. Gilt für alle drei Hero-Varianten.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HGzc6GhWhmLJt1jC2q1SRZ
2026-06-20 22:18:34 +02:00
|
|
|
|
var buttonLabel = button.textContent;
|
Neubau Fundament + Startseite: Designsystem, PHP-Komponenten, Brevo-Formular, Instagram-Sync
- Ordnerstruktur mit public/-Docroot, Deny-.htaccess für app/bin/config/data/storage
- CLAUDE.md mit Leitplanken (self-hosted only, Single Source of Truth, Component-first)
- Design-Tokens aus alter Seite extrahiert (Akzent #e20612, Coolvetica/Abel als woff2)
- Front Controller mit Routen-Register, Sitemap, Canonical, JSON-LD (SportsClub)
- Startseite: Hero, Instagram-Feed (lokaler Cache), Historie/Sportheim, Stats, Partner, Kontakt
- Kontaktformular via PHPMailer/Brevo mit Honeypot + HMAC-Time-Trap (kein reCAPTCHA)
- bin/instagram-sync.php: Scraper mit Strategie-Kette, flock, atomarem Cache, lokalen Bildern
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-11 21:16:25 +02:00
|
|
|
|
button.disabled = true;
|
|
|
|
|
|
button.textContent = 'Wird gesendet …';
|
|
|
|
|
|
|
|
|
|
|
|
fetch(form.action, {
|
|
|
|
|
|
method: 'POST',
|
|
|
|
|
|
body: new FormData(form),
|
|
|
|
|
|
headers: { Accept: 'application/json' }
|
|
|
|
|
|
})
|
|
|
|
|
|
.then(function (response) { return response.json(); })
|
|
|
|
|
|
.then(function (data) {
|
|
|
|
|
|
if (data.ok) {
|
|
|
|
|
|
show('success', MESSAGES.success);
|
|
|
|
|
|
form.reset();
|
|
|
|
|
|
} else {
|
|
|
|
|
|
show('error', MESSAGES[data.error] || MESSAGES.mail);
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
.catch(function () {
|
|
|
|
|
|
show('error', MESSAGES.mail);
|
|
|
|
|
|
})
|
|
|
|
|
|
.finally(function () {
|
|
|
|
|
|
button.disabled = false;
|
Feinschliff: Formulare neu, Glas global dunkler, Hero-Fade sauber
Formulare (form-field.php, 3 Form-Wrapper, components.css, form.js):
- Floating Labels (Label im Feld, wandert bei Fokus/Inhalt hoch; select/date
dauerhaft oben) via :has() + placeholder=" "-Trick. Echtes <label> bleibt
im DOM (kein Placeholder-als-Label).
- Globale "Pflichtfelder mit *"-Hinweiszeile entfernt; Stern bleibt am Feld,
pro Feld als visually-hidden "(Pflichtfeld)" für Screenreader erklärt.
- Markenroter Fokus-Ring statt Weiß.
- Felder als sanfter Füll-Look: weichere Ränder (eigene --clr-field-*-Tokens),
Erkennbarkeit über Fläche + Rand (WCAG 1.4.11 erfüllt).
- form.js: Submit-Button-Text wird je Formular korrekt wiederhergestellt.
Glas-Look global (tokens.css, components.css):
- Frosted Glass zentral: --glass-blur + --glass-shadow (Glow + Top-Sheen),
eine Regel statt 28× wiederholt; Leaf-Karten mit Blur, Container nur Glow
(kein Doppel-Frost). @supports-Fallback.
- Dunkleres Glas (--clr-glass-bg auf Schwarz-Tint), dezenter Card-Rand.
Hero-Fade (components.css):
- Unterer Auslauf nicht mehr mit grauem --clr-bg zugedeckt, sondern .hero__media
per mask-image ausgeblendet → echter dunkler, texturierter Hintergrund scheint
durch (schwärzer, durchsichtig, kein graues Band). Abdunklung auf reines
Schwarz. Gilt für alle drei Hero-Varianten.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HGzc6GhWhmLJt1jC2q1SRZ
2026-06-20 22:18:34 +02:00
|
|
|
|
button.textContent = buttonLabel;
|
Neubau Fundament + Startseite: Designsystem, PHP-Komponenten, Brevo-Formular, Instagram-Sync
- Ordnerstruktur mit public/-Docroot, Deny-.htaccess für app/bin/config/data/storage
- CLAUDE.md mit Leitplanken (self-hosted only, Single Source of Truth, Component-first)
- Design-Tokens aus alter Seite extrahiert (Akzent #e20612, Coolvetica/Abel als woff2)
- Front Controller mit Routen-Register, Sitemap, Canonical, JSON-LD (SportsClub)
- Startseite: Hero, Instagram-Feed (lokaler Cache), Historie/Sportheim, Stats, Partner, Kontakt
- Kontaktformular via PHPMailer/Brevo mit Honeypot + HMAC-Time-Trap (kein reCAPTCHA)
- bin/instagram-sync.php: Scraper mit Strategie-Kette, flock, atomarem Cache, lokalen Bildern
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-11 21:16:25 +02:00
|
|
|
|
});
|
|
|
|
|
|
});
|
|
|
|
|
|
})();
|