1const COMPLETE_ALL_FIELDS = "Please complete all the fields below."; 2var captchaCopied = false; 3 4$(document).ready(function () { 5 $('#franchise-contact-step-1').click(function (e) { 6 e.preventDefault(); 7 var nextStep = true; 8 var errors = []; 9 10 $('#franchise-home-contact .step-1 input').each(function () { 11 $(this).removeClass('error'); 12 if ($(this).val() == "") { 13 $(this).addClass('error'); 14 if (errors.indexOf(COMPLETE_ALL_FIELDS) === -1) { 15 errors.push(COMPLETE_ALL_FIELDS); 16 } 17 nextStep = false; 18 } 19 }); 20 if (nextStep) { 21 $('#home-alert-text').fadeOut(); 22 $('#franchise-home-contact .step-1').hide(); 23 $('#franchise-home-contact .step-2').show(); 24 $('#franchise-home-contact .step-2 input').first().focus(); 25 } 26 else { 27 if (errors.length > 0) { 28 var strErrors = errors.join('<br />'); 29 $('#home-alert-text').fadeIn().html(strErrors); 30 } 31 } 32 33 $('#franchise-contact-form input').change(function () { 34 revertCaptcha(); 35 }); 36 37 $('#franchise-contact-form input, #franchise-contact-form a.btn').click(function () { 38 revertCaptcha(); 39 }); 40 }); 41 42 function revertCaptcha() { 43 if (captchaCopied) { 44 // Go back to first screen 45 $('#home-alert-text').fadeOut(); 46 $('#franchise-home-contact .step-1').show(); 47 $('#franchise-home-contact .step-2').hide(); 48 $('#franchise-home-contact .step-3').hide(); 49 // Move captcha back 50 $('.g-recaptcha').detach().prependTo('#franchise-contact-form .submit-row-with-captcha'); 51 captchaCopied = false; 52 } 53 } 54 55 $('#franchise-contact-step-2').click(function (e) { 56 var errors = []; 57 e.preventDefault(); 58 var nextStep = true; 59 $('#franchise-home-contact .step-2 input').each(function () { 60 $(this).removeClass('error'); 61 if ($(this).attr('type') == "email") { 62 if (!isEmail($(this).val())) { 63 $(this).addClass('error'); 64 errors.push("Email address should be in [email protected] format."); 65 nextStep = false; 66 } 67 } 68 if ($(this).attr('type') == "tel") { 69 if (!isPhone($(this).val())) { 70 $(this).addClass('error'); 71 errors.push("Phone should be in 555-555-5555 format."); 72 nextStep = false; 73 } 74 } 75 }); 76 if (nextStep) { 77 if (!captchaCopied) { 78 $('.g-recaptcha').detach().appendTo('#franchise-home-contact-captcha'); 79 captchaCopied = true; 80 } 81 $('#home-alert-text').fadeOut(); 82 $('#franchise-home-contact .step-2').hide(); 83 $('#franchise-home-contact .step-3').show(); 84 $('#franchise-home-contact .step-3 input').first().focus(); 85 } 86 else { 87 if (errors.length > 0) { 88 var strErrors = errors.join('<br />'); 89 $('#home-alert-text').fadeIn().html(strErrors); 90 } 91 } 92 }); 93 94 $('#submit-btn-container a').click(function (e) { 95 var nextStep = true; 96 var errors = []; 97 98 $('#franchise-home-contact .step-3 input').each(function () { 99 $(this).removeClass('error'); 100 if ($(this).val() == "" || !isZip($(this).val())) { 101 $(this).addClass('error'); 102 errors.push("Please enter a valid US zip code or Canadian postal code."); 103 nextStep = false; 104 } 105 }); 106 if (!nextStep) { 107 if (errors.length > 0) { 108 var strErrors = errors.join('<br />'); 109 $('#home-alert-text').fadeIn().html(strErrors); 110 } 111 e.preventDefault(); 112 } 113 else { 114 $('#home-alert-text').fadeOut(); 115 } 116 }); 117}); 118 119function isEmail(email) { 120 return /^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/.test(email); 121} 122 123function isPhone(phone) { 124 return /^[\+]?[(]?[0-9]{3}[)]?[-\s\.]?[0-9]{3}[-\s\.]?[0-9]{4,6}$/.test(phone); 125} 126 127function isZip(zip) { 128 return /^(\d{5}|[A-Za-z]\d[A-Za-z]\s?\d[A-Za-z]\d)$/.test(zip); 129}
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.