Cuestionario de adopción online y hueco para el aviso de nuevos animales

- [ga_cuestionario]: preguntas editables en ES/EU (Personalizar), borrador guardado en el
  navegador, envío a Mensajes y por correo. Páginas «Cuestionario de adopción /
  Adopzio-galdetegia» fuera del menú y con noindex; admite ?adoptar=ID.
- Pie: formulario de suscripción de MailPoet cuando se configure su shortcode.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-09-25 10:32:29 +02:00
parent 1ad21c1b08
commit d7a17a2aca
9 changed files with 188 additions and 0 deletions

View File

@@ -92,3 +92,25 @@
select.addEventListener( 'change', function () { field.hidden = select.value !== 'visita'; } );
} );
} )();
// Cuestionario: guarda el borrador en este navegador hasta que se envía.
( function () {
var done = document.querySelector( '[data-ga-clear-draft]' );
try {
if ( done ) { Object.keys( localStorage ).filter( function ( k ) { return k.indexOf( 'ga-cuestionario-' ) === 0; } ).forEach( function ( k ) { localStorage.removeItem( k ); } ); }
} catch ( e ) {}
document.querySelectorAll( 'form[data-ga-draft]' ).forEach( function ( form ) {
var key = form.dataset.gaDraft, saved = {};
try { saved = JSON.parse( localStorage.getItem( key ) || '{}' ); } catch ( e ) {}
Array.prototype.forEach.call( form.elements, function ( el ) {
if ( el.name && el.type !== 'hidden' && el.type !== 'checkbox' && saved[ el.name ] && ! el.value ) { el.value = saved[ el.name ]; }
} );
form.addEventListener( 'input', function () {
var data = {};
Array.prototype.forEach.call( form.elements, function ( el ) {
if ( el.name && el.type !== 'hidden' && el.type !== 'checkbox' && el.name !== 'web' ) { data[ el.name ] = el.value; }
} );
try { localStorage.setItem( key, JSON.stringify( data ) ); } catch ( e ) {}
} );
} );
} )();