1$(document).ready(function(){ 2 let stopFormSubmit = false; 3 let checkerText = localStorage.checkerText; 4 let emailInpSelector = ''; 5 let formSelector = ''; 6 7 let selectors = [ 8 '#contactform-email', 9 '#signupclassicform-emailphone', 10 '#loginform-emailphone', 11 '#reminderform-emailphone', 12 '#reminder2form-emailphone', 13 '#profileform-email', 14 ]; 15 16 selectors.map( (sel) => { 17 if ($(sel).length == 1) { 18 emailInpSelector = sel; 19 formSelector = '#'+$('#signupclassicform-emailphone').closest('form').attr('id'); 20 console.log(formSelector) 21 } 22 }); 23 24 const checker = emailMisspelled(); 25 26 function checkEmail(email) { 27 stopFormSubmit = true; 28 let suggestions = checker(email); 29 30 if (typeof suggestions === 'undefined') { 31 stopFormSubmit = false; 32 } 33 if (typeof suggestions !== 'undefined' && suggestions.length > 0) { 34 $(".share__descr").html(checkerText. 35 replace("{email1}",'<span class="red_email">'+email+'</span>'). 36 replace("{email2}",'<span class="red_email">'+suggestions[0].corrected+'</span>') 37 ); 38 // open popup and suggest replacement 39 showPopup(".js-popup-emailcheck"); 40 $('.doEmailReplace').focus(); 41 } 42 } 43 44 $(document).on('change',emailInpSelector,function() { 45 let email = $(this).val(); 46 checkEmail(email); 47 }); 48 49 $(document).on('click','.dontstopfrm',function() { 50 stopFormSubmit = false; 51 }); 52 53 $(document).on('click','.doEmailReplace',function() { 54 let email = $(emailInpSelector).val(); 55 let suggestions = checker(email); 56 57 if (typeof suggestions !== 'undefined' && suggestions.length > 0) { 58 const corrected_mail = suggestions[0].corrected; 59 $(emailInpSelector).val(corrected_mail); 60 localStorage.setItem('last_mail', corrected_mail); 61 stopFormSubmit = false; 62 } 63 }); 64 65 $(document).on('submit',formSelector,function(e) { 66 if ($(emailInpSelector).val().length > 0 && stopFormSubmit) { 67 e.preventDefault(); 68 $(emailInpSelector).trigger('change'); 69 } 70 }); 71});
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.