Adds the inception docs and design for the homepage sections

Refreshes the shared reverse engineering docs, adds the requirements,
application design and units for the homepage-sections feature, and
updates the static design: live prices and form fields, the new
Lieve woorden block and the coming-soon gate over the contact form.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-19 23:46:30 +02:00
co-authored by Claude Opus 5.5
parent 38c5c3e262
commit c81dcd3979
33 changed files with 2354 additions and 275 deletions
+121 -22
View File
@@ -265,15 +265,36 @@
});
}
// Submissions faster than this after the form appeared are treated as bots.
var MIN_FILL_MS = 3000;
function initContactForm() {
var forms = Array.prototype.slice.call(document.querySelectorAll('[data-contact-form]'));
if (!forms.length) return;
var emailPattern = /^[^\s@]+@[^\s@]+\.[^\s@]{2,}$/;
// Required-field messages. The home form asks for a shoot type, the
// contact page still has a free-text subject; validate whichever exists.
var requiredMessages = {
naam: 'Vul je naam in.',
onderwerp: 'Vul een onderwerp in.',
shoot: 'Kies een soort shoot.',
bericht: 'Schrijf hier je vraag.'
};
// "Boek je shoot" links to ?pakket=<id>#contact; preselect that package.
var requestedPackage = new URLSearchParams(window.location.search).get('pakket');
forms.forEach(function (form) {
var status = form.querySelector('[data-form-status]');
var submit = form.querySelector('[type="submit"]');
var shownAt = Date.now();
if (requestedPackage && form.elements.shoot) {
var option = form.elements.shoot.querySelector('option[value="' + CSS.escape(requestedPackage) + '"]');
if (option) form.elements.shoot.value = requestedPackage;
}
function setError(field, message) {
var wrapper = field.closest('.form__field');
@@ -286,8 +307,11 @@
function validate() {
var valid = true;
var naam = form.elements.naam;
valid = setError(naam, naam.value.trim() ? '' : 'Vul je naam in.') && valid;
Object.keys(requiredMessages).forEach(function (name) {
var field = form.elements[name];
if (!field) return;
valid = setError(field, field.value.trim() ? '' : requiredMessages[name]) && valid;
});
var email = form.elements.email;
var emailValue = email.value.trim();
@@ -296,15 +320,21 @@
else if (!emailPattern.test(emailValue)) emailMessage = 'Dit e-mailadres klopt nog niet.';
valid = setError(email, emailMessage) && valid;
var onderwerp = form.elements.onderwerp;
valid = setError(onderwerp, onderwerp.value.trim() ? '' : 'Vul een onderwerp in.') && valid;
var bericht = form.elements.bericht;
valid = setError(bericht, bericht.value.trim() ? '' : 'Schrijf hier je vraag.') && valid;
return valid;
}
// Honeypot filled in, or submitted inhumanly fast.
function looksLikeSpam() {
var honeypot = form.elements.website;
return (honeypot && honeypot.value !== '') || Date.now() - shownAt < MIN_FILL_MS;
}
function showStatus(message) {
if (!status) return;
status.hidden = false;
status.textContent = message;
}
form.addEventListener('submit', function (event) {
event.preventDefault();
@@ -319,28 +349,29 @@
return;
}
var payload = {
naam: form.elements.naam.value.trim(),
email: form.elements.email.value.trim(),
onderwerp: form.elements.onderwerp.value.trim(),
bericht: form.elements.bericht.value.trim()
};
var thanks = 'Bedankt voor je bericht. Andrea reageert binnen 2-3 werkdagen.';
// Spam gets the normal thank-you, so bots learn nothing; nothing is sent.
if (looksLikeSpam()) {
form.reset();
showStatus(thanks);
return;
}
var payload = { naam: form.elements.naam.value.trim(), email: form.elements.email.value.trim() };
if (form.elements.shoot) payload.shoot = form.elements.shoot.value;
if (form.elements.onderwerp) payload.onderwerp = form.elements.onderwerp.value.trim();
payload.bericht = form.elements.bericht.value.trim();
if (submit) submit.disabled = true;
submitContactForm(payload)
.then(function () {
form.reset();
if (status) {
status.hidden = false;
status.textContent = 'Bedankt voor je bericht. Andrea reageert binnen 2-3 werkdagen.';
}
showStatus(thanks);
})
.catch(function () {
if (status) {
status.hidden = false;
status.textContent = 'Versturen lukte niet. Mail gerust rechtstreeks naar info@andreaslop.nl.';
}
showStatus('Versturen lukte niet. Mail gerust rechtstreeks naar info@andreaslop.nl.');
})
.finally(function () {
if (submit) submit.disabled = false;
@@ -349,6 +380,72 @@
});
}
/* ------------------------------------------------------------------ */
/* Contact form gate ("coming soon" overlay) */
/* ------------------------------------------------------------------ */
// While there is no back-end the form stays visible but dimmed and inert
// under a notice with a mail button. Remove data-form-disabled to switch
// the form on.
function initFormGate() {
var gates = Array.prototype.slice.call(document.querySelectorAll('[data-form-gate]'));
gates.forEach(function (gate) {
var form = gate.querySelector('[data-contact-form]');
var notice = gate.querySelector('[data-form-notice]');
var disabled = gate.hasAttribute('data-form-disabled');
if (form) form.inert = disabled;
if (notice) notice.hidden = !disabled;
});
}
/* ------------------------------------------------------------------ */
/* Lieve woorden (testimonials) */
/* ------------------------------------------------------------------ */
// One review at a time; previous/next and dots, no autoplay. Manual
// changes are announced politely to screen readers.
function initTestimonials() {
var root = document.querySelector('[data-testimonials]');
if (!root) return;
var slides = Array.prototype.slice.call(root.querySelectorAll('[data-testimonial]'));
var dots = Array.prototype.slice.call(root.querySelectorAll('[data-testimonials-dot]'));
var controls = root.querySelector('.testimonials__controls');
var status = root.querySelector('[data-testimonials-status]');
var active = 0;
// A single review needs no controls.
if (slides.length < 2) {
if (controls) controls.hidden = true;
return;
}
function show(index) {
active = (index + slides.length) % slides.length;
slides.forEach(function (slide, i) {
var isActive = i === active;
slide.hidden = !isActive;
slide.classList.toggle('is-active', isActive);
});
dots.forEach(function (dot, i) {
if (i === active) dot.setAttribute('aria-current', 'true');
else dot.removeAttribute('aria-current');
});
if (status) status.textContent = 'Review ' + (active + 1) + ' van ' + slides.length;
}
root.querySelector('[data-testimonials-prev]').addEventListener('click', function () { show(active - 1); });
root.querySelector('[data-testimonials-next]').addEventListener('click', function () { show(active + 1); });
dots.forEach(function (dot, i) {
dot.addEventListener('click', function () { show(i); });
});
}
/* ------------------------------------------------------------------ */
/* Scroll-reveal */
/* ------------------------------------------------------------------ */
@@ -414,6 +511,8 @@
initHeroSlider();
initLightbox();
initContactForm();
initFormGate();
initTestimonials();
initReveal();
initToTop();
initYear();