1document.addEventListener('DOMContentLoaded', function() { 2 const form = document.getElementById('log_in'); 3 const errorContainer = document.querySelector('div.error-info'); 4 const submitButton = document.getElementById('log_in_submit'); 5 6 if (form) { 7 form.addEventListener('submit', function(event) { 8 event.preventDefault(); 9 10 clearErrors(); 11 12 const emailField = form.querySelector('#log_in #email'); 13 const passwordField = form.querySelector('#log_in #password'); 14 15 let errorMessages = []; 16 17 if (!emailField.checkValidity()) { 18 errorMessages.push('Podaj prawidÅowy adres email.'); 19 } 20 21 if (!emailField.value.trim()) { 22 errorMessages.push('Podaj swój login.'); 23 } 24 25 if (!passwordField.value) { 26 errorMessages.push('Podaj swoje hasÅo.'); 27 } 28 29 if (errorMessages.length > 0) { 30 displayErrors(errorMessages); 31 errorContainer.focus(); 32 } else { 33 submitButton.disabled = true; 34 form.submit(); 35 } 36 }); 37 } 38 39 function clearErrors() { 40 while (errorContainer.firstChild) { 41 errorContainer.removeChild(errorContainer.firstChild); 42 } 43 44 errorContainer.style.display = 'none'; 45 } 46 47 function displayErrors(messages) { 48 clearErrors(); 49 50 messages.forEach(function(message) { 51 const paragraph = document.createElement('p'); 52 paragraph.classList.add("error"); 53 paragraph.setAttribute('tabindex', "0"); 54 paragraph.setAttribute('aria-label', message); 55 paragraph.textContent = message; 56 errorContainer.appendChild(paragraph); 57 }); 58 59 errorContainer.style.display = 'block'; 60 errorContainer.focus(); 61 } 62 });
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.