1function getTheForm(email_user_id, formIndex) { 2 let mailtoFormTemplate = `<div class="mailto-form-container" style="position:relative; width:100%"><div class="card-customize-staff-reveal" style="display: none; z-index:999; background:white; border: 1px solid #cecece; padding: 20px; width:345px; position:absolute; left:0; bottom:0;"> 3<span class="card-title"></span> 4<button type="button" class="close" data-dismiss="modal" aria-label="Close" style="margin-top: -20px; margin-right: -10px;opacity:.3; font-size:23px"> 5 <span aria-hidden="true">Ã</span> 6</button> 7<div class="card_reveal_message${formIndex}" style="margin-top: -16px;"></div> 8<form method="post" class="login-form lpfrm" action="" id="form_submission${formIndex}"> 9<div class="login-error"> 10 <span style="color:red;font-size:14px;padding-bottom:5px;"></span> 11</div> 12<div class="form-group"> 13 <textarea name="usr_message" id="usr_message" class="usr_message" required autocomplete="off" value="" placeholder="Message" onfocus="this.placeholder=''" onblur="this.placeholder='Message'" style="width: 100%; padding: 8px 20px; border: 1px solid #ddd; height:75px; color:#9e9e9e; transition:all .3s; outline-width:0"></textarea> 14</div> 15<div class="form-group"> 16 <input type="text" name="usr_name" id="usr_name" class="usr_name" required autocomplete="off" value="" placeholder="Your name" onfocus="this.placeholder=''" onblur="this.placeholder='Your name'" style="width: 100%; padding: 8px 20px; border: 1px solid #ddd; height:44px; color:#9e9e9e; transition:all .3s; outline-width:0"/> 17</div> 18<div class="form-group"> 19 <input type="text" name="usr_email" id="usr_email" class="usr_email" required autocomplete="off" value="" placeholder="Your email address" onfocus="this.placeholder=''" onblur="this.placeholder='Your email address'" style="width: 100%; padding: 8px 20px; border: 1px solid #ddd; height:44px; color:#9e9e9e; transition:all .3s; outline-width:0"/> 20</div> 21<div class="form-group"> 22 <input type="text" name="usr_phone" id="usr_phone" class="usr_phone" required autocomplete="off" value="" placeholder="Your phone number" onfocus="this.placeholder=''" onblur="this.placeholder='Your phone number'" style="width: 100%; padding: 8px 20px; border: 1px solid #ddd; height:44px; color:#9e9e9e; transition:all .3s; outline-width:0"/> 23</div> 24<div class="form-group"> 25 <div class="g-recaptcha" data-sitekey="6LelfKckAAAAAFDtY4WZtEDGy-BY46vzb1TIGEaY"></div> 26</div> 27<input type="hidden" name="email_user_id" id="email_user_id" class="council_email" value="${email_user_id}" /> 28<button class="submitton btn btn-default" type="submit" id="loginuser" name="${formIndex}">Submit</button> 29<div id="xloginbottom"><span class="message"></span></div> 30</form> 31<div class="footnote">A copy of this message will be sent to your email address.</div> 32</div></div>`; 33 34 return mailtoFormTemplate; 35} 36 37 38 39$(document).ready(function(){ 40 $(".foo-widget .contact-address a[href^='mailto:']").each( function(index) { 41 let mailto = $(this).attr('href'); 42 $(this).attr('href', $(this).text()); // hide email with text+index 43 44 $(this).before( getTheForm(mailto, index) ); 45 $(this).on('click',function(e){ 46 e.preventDefault(); // stop the links deafult action 47 $('.card-customize-staff-reveal', $(this).prev('.mailto-form-container') ).slideToggle('slow'); 48 }) 49 $('.card-customize-staff-reveal .close', $(this).prev('.mailto-form-container')).on('click',function(){ 50 $(this).parent('.card-customize-staff-reveal').slideToggle('slow'); 51 }); 52 53 $('.submitton', $(this).prev('.mailto-form-container') ).on('click',function(){ 54 var formid = $(this).attr('name'); 55 var usr_message = $("#form_submission"+formid+" #usr_message").val(); 56 var usr_name = $("#form_submission"+formid+" #usr_name").val(); 57 var usr_email = $("#form_submission"+formid+" #usr_email").val(); 58 var usr_phone = $("#form_submission"+formid+" #usr_phone").val(); 59 var fieldempty = '0'; 60 var email_regex = /^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/i; 61 62 if(usr_message !='' && usr_name!='' && usr_email !='' && usr_phone !='' && email_regex.test(usr_email)){ 63 var fieldempty = '0'; 64 }else{ 65 var fieldempty = '1'; 66 } 67 68 if(usr_message == ''){ 69 $("#form_submission"+formid+" span.error-usr_message").remove(); 70 $("<span class='error error-usr_message' style='font-size:12px;color:red' >Message field is required</span>").insertAfter("#form_submission"+formid+" #usr_message"); 71 }else{ 72 $("#form_submission"+formid+" span.error-usr_message").remove(); 73 } 74 75 if(usr_name ==''){ 76 $("#form_submission"+formid+" span.error-usr_name").remove(); 77 $("<span class='error error-usr_name' style='font-size:12px;color:red'>Name field is required</span>").insertAfter("#form_submission"+formid+" #usr_name"); 78 }else{ 79 $("#form_submission"+formid+" span.error-usr_name").remove(); 80 } 81 82 if(usr_email ==''){ 83 $("#form_submission"+formid+" span.error-email").remove(); 84 $("<span class='error error-email' style='font-size:12px;color:red'>Email field is required</span>").insertAfter("#form_submission"+formid+" #usr_email"); 85 }else { 86 if(!email_regex.test(usr_email)){ 87 $("#form_submission"+formid+" span.error-email").remove(); 88 $("<span class='error error-email' style='font-size:12px;color:red'>
88Email field is not valid</span>").insertAfter("#form_submission"+formid+" #usr_email"); 89 }else{ 90 $("#form_submission"+formid+" span.error-email").remove(); 91 } 92 } 93 94 if(usr_phone ==''){ 95 $("#form_submission"+formid+" span.error-phone").remove(); 96 $("<span class='error error-phone' style='font-size:12px;color:red'>Phone field is required</span>").insertAfter("#form_submission"+formid+" #usr_phone"); 97 }else{ 98 $("#form_submission"+formid+" span.error-phone").remove(); 99 } 100 101 if(fieldempty != '1'){ 102 $('#form_submission'+formid+' .submittion').prop('disabled', true); 103 var formdata = $("#form_submission"+formid+"").serialize(); 104 105 $.ajax({ 106 type : 'POST', 107 url : '/views/mailtoform_secure_email.php', 108 data :formdata, 109 dataType : 'json', 110 cache: false, 111 112 success : function(response) { 113 if(response.one == 'error') { 114 $(".card_reveal_message"+formid+"").html(response.success); 115 $('#form_submission'+formid+' .submittion').prop('disabled', false); 116 $('#form_submission'+formid+' .submittion').removeAttr('disabled'); 117 } else { 118 $(".card_reveal_message"+formid+"").html(response.success); 119 $("#form_submission"+formid+"").css('display','none'); 120 $('#form_submission'+formid+' .submittion').prop('disabled', false); 121 $('#form_submission'+formid+' .submittion').removeAttr('disabled'); 122 setTimeout(function(){ 123 $("#form_submission"+formid+"").parent('.card-customize-staff-reveal').slideToggle('slow'); 124 }, 7000); 125 } 126 127 return false; 128 }, 129 130 error: function(jqXHR, exception) { 131 } 132 }); 133 return false; 134 }else{ 135 return false; 136 } 137 138 }); 139 }); 140 141 142});
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.