1 2// jQuery Ready State 3jQuery( document ).ready( function( $ ) { 4 5 // Check On Prepopulated Form 6 bmew_billing_email_checker( $ ); 7 8 // Check On Data Entry 9 $( '#billing_email' ).keyup( function() { 10 bmew_input_delay( function() { 11 bmew_billing_email_checker( $ ); 12 }, 2000 ); 13 } ); 14} ); 15 16// Delay Typeahead Prototype 17var bmew_input_delay = ( function() { 18 var timer = 0; 19 return function( callback, ms ) { 20 clearTimeout ( timer ); 21 timer = setTimeout( callback, ms ); 22 }; 23} )(); 24 25// Checks Email Form 26function bmew_billing_email_checker( $ ) { 27 28 // Require Completed Email Address 29 if( ! bmew_is_email( $( '#billing_email' ).val() ) ) { 30 return false; 31 } 32 33 // Save For Abandoned Cart Automations 34 var data = { 35 'action': 'bmew_action', 36 'sync': 'abandoned_cart', 37 'email': $( '#billing_email' ).val(), 38 'billing_first_name': $( '#billing_first_name' ).val(), 39 'billing_last_name': $( '#billing_last_name' ).val() 40 }; 41 $.post( bmew_ajax_object.ajax_url, data, function( response ) { 42 //alert( 'Abandoned cart for ' + response ); 43 } ); 44} 45 46// Validate Email Address String 47function bmew_is_email( email ) { 48 var regex = /^([a-zA-Z0-9_.+-])+\@(([a-zA-Z0-9-])+\.)+([a-zA-Z0-9]{2,4})+$/; 49 return regex.test( email ); 50}
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.