1/* 2omnisend_woo_data - object is created by WP, check following properties bellow 3ajax_url 4 */ 5let omnisend_email_submitted = ''; 6let omnisend_email_submit_in_progress = false; 7const omnisend_contact_id = getCookieValue('omnisendContactID'); 8 9window.addEventListener('load', function () { 10 const elements = ['#billing_email', '.wc-block-components-text-input > #email']; 11 12 elements.forEach(function (selector) { 13 var emailInput = document.querySelector(selector); 14 if (emailInput) { 15 emailInput.addEventListener('focus', omnisend_handle_email_change); 16 emailInput.addEventListener('change', omnisend_handle_email_change); 17 } 18 }); 19}); 20 21function omnisend_handle_email_change(event) { 22 if (omnisend_email_submit_in_progress) { 23 return; 24 } 25 26 omnisend_email_submit_in_progress = true; 27 28 var email = event.target.value; 29 30 var validEmail = function (email) { 31 return /^[a-zA-Z0-9.!#$%&â*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/.test(email); 32 }; 33 34 if (!validEmail(email)) { 35 omnisend_email_submit_in_progress = false; 36 return; 37 } 38 39 if (omnisend_email_submitted === email) { 40 omnisend_email_submit_in_progress = false; 41 return; 42 } 43 44 var urlParams = new URLSearchParams({ 45 action: 'omnisend_identify', 46 email: email, 47 _wpnonce: omnisend_woo_data.nonce 48 }); 49 50 if (omnisend_contact_id) { 51 urlParams.set('contact_id', omnisend_contact_id); 52 } 53 54 var url = omnisend_woo_data.ajax_url + '?' + urlParams.toString(); 55 56 fetch(url, { 57 method: 'POST', 58 headers: { 59 Accept: 'application/json' 60 } 61 }) 62 .then(function (response) { 63 var successful = response.status >= 200 && response.status < 400; 64 if (successful) { 65 omnisend_email_submitted = email; 66 } 67 omnisend_email_submit_in_progress = false; 68 }) 69 .catch(function () { 70 omnisend_email_submit_in_progress = false; 71 }); 72} 73 74function getCookieValue(key) { 75 const cookies = Object.fromEntries(document.cookie.split(';
75 ').map((cookie) => cookie.split('='))); 76 return cookies[key] ? decodeURIComponent(cookies[key]) : null; 77}
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.