1document.addEventListener('DOMContentLoaded', () => { 2 const honeypotFieldset = document.querySelector('fieldset.form-fieldset--sr'); 3 if (!honeypotFieldset) return; 4 5 const honeypotInputs = honeypotFieldset.querySelectorAll('input'); 6 const lastFieldset = document.querySelectorAll('fieldset'); 7 const last = lastFieldset[lastFieldset.length - 1]; 8 9 // Div erstellen 10 const newDiv = document.createElement('div'); 11 newDiv.className = 'form-field form-alert form-alert--withBg'; 12 // Basis-Styles für form-field-honeypot und form-alert--error 13 newDiv.style.marginTop = '1em'; 14 newDiv.style.backgroundColor = '#f2dede'; 15 newDiv.style.padding = '1em'; 16 newDiv.style.display = 'none'; // hidden 17 18 const description = document.createElement('div'); 19 newDiv.appendChild(description); 20 21 const button = document.createElement('button'); 22 button.type = 'button'; 23 button.textContent = 'Bestätigen'; 24 // Button-Styles 25 button.style.marginTop = '0.5em'; 26 newDiv.appendChild(button); 27 28 last.insertAdjacentElement('afterend', newDiv); 29 30 let isSuccessState = false; 31 32 const checkHoneypots = () => { 33 const hasValue = Array.from(honeypotInputs).some(input => input.value.trim() !== ''); 34 if (hasValue) { 35 // Error state 36 newDiv.style.display = 'block'; 37 newDiv.style.backgroundColor = '#f2dede'; 38 description.textContent = 'Bitte bestätigen Sie, dass Ihre Angaben korrekt sind.'; 39 button.style.display = 'inline-block'; 40 isSuccessState = false; 41 } else if (!hasValue && !isSuccessState) { 42 // Hidden state 43 newDiv.style.display = 'none'; 44 } 45 }; 46 47 honeypotInputs.forEach(input => input.addEventListener('input', checkHoneypots)); 48 49 button.addEventListener('click', () => { 50 honeypotInputs.forEach(input => input.value = ''); 51 // Success state 52 newDiv.style.backgroundColor = '#dff0d8'; 53 newDiv.style.display = 'block'; 54 description.textContent = 'Vielen Dank für die Bestätigung, dass Ihre Angaben korrekt sind!'; 55 button.style.display = 'none'; 56 isSuccessState = true; 57 }); 58 59 checkHoneypots(); // initial prüfen 60});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.