1(function () { 2 'use strict'; 3 if (typeof PG_NEWSLETTER === 'undefined') { return; } 4 5 var form = document.getElementById('pg-newsletter-form'); 6 if (!form) { return; } 7 8 var msg = document.getElementById('pg-newsletter-msg'); 9 var btn = form.querySelector('button[type="submit"]'); 10 11 function show(text, ok) { 12 if (!msg) { return; } 13 msg.textContent = text; 14 msg.classList.remove('hidden'); 15 msg.style.background = ok ? 'rgba(38,166,154,.15)' : 'rgba(220,50,50,.12)'; 16 msg.style.color = ok ? '#7ee0d3' : '#ff8a8a'; 17 } 18 19 form.addEventListener('submit', function (e) { 20 e.preventDefault(); 21 22 var email = form.querySelector('[name="email"]').value.trim(); 23 var region = form.querySelector('[name="region"]') ? form.querySelector('[name="region"]').value : ''; 24 var consent = form.querySelector('[name="consent"]').checked; 25 var hp = form.querySelector('[name="pg_hp"]') ? form.querySelector('[name="pg_hp"]').value : ''; 26 27 if (!consent) { show('ΧÏειάζεÏαι η ÏÏ Î³ÎºÎ±ÏάθεÏή ÏÎ¿Ï .', false); return; } 28 29 if (btn) { btn.disabled = true; } 30 31 var body = 'action=pg_newsletter_subscribe' 32 + '&nonce=' + encodeURIComponent(PG_NEWSLETTER.nonce) 33 + '&email=' + encodeURIComponent(email) 34 + '®ion=' + encodeURIComponent(region) 35 + '&consent=' + (consent ? '1' : '') 36 + '&pg_hp=' + encodeURIComponent(hp); 37 38 fetch(PG_NEWSLETTER.ajaxUrl, { 39 method: 'POST', 40 headers: { 'Content-Type': 'application/x-www-form-urlencoded' }, 41 body: body 42 }).then(function (r) { return r.json(); }).then(function (res) { 43 if (res && res.success) { 44 show((res.data && res.data.message) || 'ÎÏ ÏαÏιÏÏοÏμε!', true); 45 form.reset(); 46 } else { 47 show((res && res.data && res.data.message) || 'ÎάÏι Ïήγε ÏÏÏαβά.', false); 48 } 49 }).catch(function () { 50 show('ΣÏάλμα δικÏÏÎ¿Ï . Î ÏοÏÏάθηÏε ξανά.', false); 51 }).finally(function () { 52 if (btn) { btn.disabled = false; } 53 }); 54 }); 55})();
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.