1jQuery(document).ready(function($){ 2 3 $('input[name="OF_NAME"][id*="optinforms"]').each(function(){ 4 if ( ! $(this).is(':visible') ) { 5 $(this).prop( 'required', false ); 6 } 7 }) 8 9 $('input[name="name"][id*="optinforms"]').each(function(){ 10 if ( ! $(this).is(':visible') ) { 11 $(this).prop( 'required', false ); 12 } 13 }) 14 15 $('input[name="fields[name]"][id*="optinforms"]').each(function(){ 16 if ( ! $(this).is(':visible') ) { 17 $(this).prop( 'required', false ); 18 } 19 }) 20 21 $(document).on( 'keyup change', 'input[name="OF_NAME"]', function(){ 22 23 var fullName = '', 24 firstName = '', 25 lastName = '', 26 wrapper = $(this).closest('.optinforms-form-container'); 27 28 fullName = $(this).val(); 29 fullName = fullName.split(' '); 30 console.log( fullName ); 31 $.each( fullName, function( key, value ) { 32 if ( key == 0 ) { 33 firstName += value; 34 } else if ( key == 1 ) { 35 lastName += value; 36 } else { 37 lastName += ' ' + value; 38 } 39 }); 40 $('input[name="FNAME"].optinforms-mailchimp-field', wrapper).val( firstName ); 41 $('input[name="LNAME"].optinforms-mailchimp-field', wrapper).val( lastName ); 42 }); 43 44}); 45 46document.addEventListener('DOMContentLoaded', function() { 47 let element = document.querySelector('.optinforms-solution-mailerlite'); 48 if ( element ) { 49 element.addEventListener('submit', function (event) { 50 event.preventDefault(); 51 let form = this; 52 form.querySelector('.optinforms-status-success-message').style.display = 'none'; 53 form.querySelector('.optinforms-status-error-message').style.display = 'none'; 54 fetch(form.getAttribute('action'), { 55 method: form.getAttribute('method'), 56 body: new FormData(form) 57 }).then(res=>res.text()).then(function (data) { 58 let result = JSON.parse(data); 59 if ( result.success ) { 60 form.querySelector('.optinforms-status-success-message').style.display = 'block'; 61 } else { 62 form.querySelector('.optinforms-status-error-message').style.display = 'block'; 63 } 64 }); 65 }); 66 } 67});
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.