Miniaturas HD, formulario de patrocinadores y sección Lo más visto
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TSyR5Zw5eGj6oPTRVjvP1b
This commit is contained in:
co-authored by
Claude Sonnet 5.5
parent
e8b1f765c8
commit
c8afac0f6d
+3
-31
@@ -12,14 +12,14 @@
|
||||
<body>
|
||||
<header class="top">
|
||||
<a class="brand" href="/" aria-label="Anda Que No Sabes Ná, inicio"><img src="img/avatar.jpg" alt="" width="40" height="40"><span>Anda que no sabes ná</span></a>
|
||||
<nav aria-label="Principal"><a href="/">Inicio</a><a href="/#quienes">Quiénes somos</a></nav>
|
||||
<nav aria-label="Principal"><a href="/">Inicio</a><a href="/#quienes">Quiénes somos</a><a href="patrocinadores.html">Patrocinadores</a></nav>
|
||||
</header>
|
||||
|
||||
<main class="legal contact">
|
||||
<h1>¿Quieres venir al <em>programa</em>?</h1>
|
||||
<p class="lead-c">Cuéntanos quién eres y de qué te gustaría hablar. También puedes proponer un tema o simplemente escribirnos. Te respondemos por correo.</p>
|
||||
|
||||
<form id="f" class="form" novalidate>
|
||||
<form id="f" class="form" novalidate data-endpoint="/api/contacto" data-mail="andaquenosabesnada@gmail.com" data-ok="¡Gracias! Hemos recibido tu mensaje y te responderemos pronto.">
|
||||
<label>Nombre
|
||||
<input name="nombre" type="text" autocomplete="name" maxlength="100" required>
|
||||
</label>
|
||||
@@ -47,34 +47,6 @@
|
||||
<noscript><p>Necesitas JavaScript para usar el formulario. Mientras tanto, escríbenos a <a href="mailto:andaquenosabesnada@gmail.com">andaquenosabesnada@gmail.com</a>.</p></noscript>
|
||||
</main>
|
||||
|
||||
<script>
|
||||
(function () {
|
||||
var f = document.getElementById('f'), st = document.getElementById('st'), t0 = Date.now(), busy = false;
|
||||
function say(msg, ok) { st.textContent = msg; st.className = 'status ' + (ok ? 'ok' : 'err'); }
|
||||
f.addEventListener('submit', function (e) {
|
||||
e.preventDefault();
|
||||
if (busy) return;
|
||||
var d = new FormData(f);
|
||||
var body = {
|
||||
nombre: (d.get('nombre') || '').trim(), email: (d.get('email') || '').trim(),
|
||||
motivo: d.get('motivo'), mensaje: (d.get('mensaje') || '').trim(),
|
||||
consent: f.consent.checked, web: d.get('web') || '', t: Date.now() - t0
|
||||
};
|
||||
if (!body.nombre || !/^[^@\s]+@[^@\s]+\.[^@\s]{2,}$/.test(body.email) || body.mensaje.length < 10 || !body.consent) {
|
||||
say('Revisa los campos: nombre, correo válido, un mensaje de al menos 10 caracteres y la casilla de privacidad.', false);
|
||||
return;
|
||||
}
|
||||
busy = true; say('Enviando…', true);
|
||||
fetch('/api/contacto', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(body) })
|
||||
.then(function (r) { return r.json().catch(function () { return {}; }).then(function (j) { return { ok: r.ok && j.ok, j: j }; }); })
|
||||
.then(function (x) {
|
||||
if (x.ok) { f.reset(); say('¡Gracias! Hemos recibido tu mensaje y te responderemos pronto.', true); }
|
||||
else { say((x.j && x.j.error) || 'No se pudo enviar. Escríbenos a andaquenosabesnada@gmail.com.', false); }
|
||||
})
|
||||
.catch(function () { say('No se pudo enviar. Escríbenos a andaquenosabesnada@gmail.com.', false); })
|
||||
.then(function () { busy = false; });
|
||||
});
|
||||
})();
|
||||
</script>
|
||||
<script src="form.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user