1document.addEventListener('DOMContentLoaded', function() { 2 var modalEl = document.getElementById('notificationModal'); 3 var notificationModal = modalEl ? bootstrap.Modal.getOrCreateInstance(modalEl) : null; 4 5 var notificationBtn = document.getElementById('notification-btn'); 6 if (notificationBtn) { 7 notificationBtn.addEventListener('click', function() { 8 notificationModal.show(); 9 }); 10 } else { 11 console.error('Notification button not found'); 12 } 13 14 var form = document.getElementById('individualNotificationForm'); 15 if (!form) { 16 console.error('Individual notification form not found'); 17 return; 18 } 19 20 form.addEventListener('submit', async function(e) { 21 e.preventDefault(); 22 23 var submitButton = form.querySelector('button[type="submit"]'); 24 var submitDefaultHtml = submitButton.innerHTML; 25 submitButton.disabled = true; 26 submitButton.innerHTML = '<span class="spinner-border spinner-border-sm me-2" role="status" aria-hidden="true"></span>Küldésâ¦'; 27 28 var data = { 29 email: form.querySelector('input[name="email"]').value, 30 keywords: [], 31 docTypes: [], 32 privacyConsent: form.querySelector('input[name="privacyConsent"]').checked, 33 userType: 'individual', 34 companyData: {} 35 }; 36 37 document.querySelectorAll('#keywordsList .keyword-tag').forEach(function(el) { 38 var keyword = el.textContent.replace('Ã', '').trim(); 39 if (keyword) { 40 data.keywords.push(keyword); 41 } 42 }); 43 44 form.querySelectorAll('input[name="docTypes[]"]:checked').forEach(function(checkbox) { 45 if (checkbox.value !== 'on') { 46 data.docTypes.push(checkbox.value); 47 } 48 }); 49 50 try { 51 var response = await fetch('/api/subscribe', { 52 method: 'POST', 53 headers: { 'Content-Type': 'application/json' }, 54 body: JSON.stringify(data) 55 }); 56 var result = await response.json(); 57 if (response.ok) { 58 if (result.message === 'Feliratkozás sikeres') { 59 toastr.success(result.message); 60 } else if (result.message === 'Email cÃm már használatban') { 61 toastr.warning(result.message); 62 } else { 63 toastr.info(result.message); 64 } 65 notificationModal.hide(); 66 form.reset(); 67 } else { 68 toastr.error(result.error || 'Hiba történt a feliratkozás során.'); 69 } 70 } catch (error) { 71 console.error('Error:', error); 72 toastr.error('Hiba történt a feliratkozás során.'); 73 } finally { 74 submitButton.disabled = false; 75 submitButton.innerHTML = submitDefaultHtml; 76 } 77 }); 78});
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.