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