1function validateEmail(email) { 2 const re = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/; 3 return re.test(email); 4} 5 6var sendTo = null; 7var FORMS = {}; 8 FORMS.Init = function(){ 9 $('.form:not(.converted)').each(function(){ 10 $(this).addClass('converted'); 11 if(!$(this).hasClass("isNL")){ 12 $(this).find('.act a.btn.primary').unbind('click'); 13 $(this).find('.act a.btn.primary').bind('click',function(){ 14 15 var send = true; 16 var _FORM = $(this).closest('.form'); 17 if(_FORM.attr('data-to')){ 18 sendTo = _FORM.attr('data-to'); 19 } 20 _FORM.find('input').each(function(){ 21 if($(this).attr("required") && $(this).attr("type")!="checkbox" && $.trim($(this).val())==""){ 22 $(this).addClass('error'); 23 send = false; 24 } 25 else{ 26 $(this).removeClass('error'); 27 } 28 }); 29 _FORM.find('textarea').each(function(){ 30 if($(this).attr("required") && $.trim($(this).val())==""){ 31 $(this).addClass('error'); 32 send = false; 33 } 34 else{ 35 $(this).removeClass('error'); 36 } 37 }); 38 _FORM.find('select').each(function(){ 39 if($(this).attr("required") && $.trim($(this).val())==""){ 40 $(this).addClass('error'); 41 send = false; 42 } 43 else{ 44 $(this).removeClass('error'); 45 } 46 }); 47 _FORM.find('.input.cb input').each(function(){ 48 if($(this).attr("required") && $(this).prop("checked")==false){ 49 $(this).closest('.input').addClass('error'); 50 send = false; 51 } 52 else{ 53 $(this).closest('.input').removeClass('error'); 54 } 55 }); 56 57 _FORM.find('input[type="email"]').each(function(){ 58 var _EMAIL = $(this).val(); 59 if (!validateEmail(_EMAIL)) { 60 $(this).addClass('error'); 61 send = false; 62 }else{ 63 $(this).removeClass('error'); 64 } 65 }); 66 _FORM.find('input[name="email"]').each(function(){ 67 var _EMAIL = $(this).val(); 68 if (!validateEmail(_EMAIL)) { 69 $(this).addClass('error'); 70 send = false; 71 }else{ 72 $(this).removeClass('error'); 73 } 74 }); 75 76 77 if(send == true){ 78 FORMS.sendForm(_FORM,sendTo); 79 }else{ 80 SYS.alert('Fehler','Sie haben nicht alle benötigten Felder vollständig ausgefüllt. Versuchen Sie es noch einmal.',false); 81 } 82 }); 83 } 84 }); 85 }; 86 FORMS.sendForm = function(_FORM){ 87 SYS.info('Bitte warten','Der Versand Ihrer Nachricht wird vorbereitet. Bitte warten Sie einen kleinen Moment.'); 88 var _DATA = {}; 89 _FORM.find('input').each(function(){ 90 if($(this).attr("type")!="checkbox"){ 91 _DATA[$(this).attr("data-name")] = $(this).val(); 92 } 93 }); 94 _FORM.find('input[type="checkbox"]').each(function(){ 95 if($(this).prop("checked")==true){ 96 _DATA[$(this).attr("data-name")] = "y"; 97 }else{ 98 _DATA[$(this).attr("data-name")] = "n"; 99 } 100 }); 101 _FORM.find('input[type="radio"]').each(function(){ 102 if($(this).prop("checked")==true){ 103 _DATA[$(this).attr("data-name")] = $(this).val(); 104 } 105 }); 106 _FORM.find('select').each(function(){ 107 _DATA[$(this).attr("data-name")] = $(this).val(); 108 }); 109 _FORM.find('textarea').each(function(){ 110 _DATA[$(this).attr("data-name")] = $(this).val(); 111 }); 112 113 $.ajax({ 114 method: "POST", 115 url: "./api", 116 data: { 117 "do": "send_mail", 118 "to": sendTo, 119 "data" : _DATA, 120 "_" : Math.random() 121 }, 122 success: function(data){ 123 var API = JSON.parse(data); 124 if(!API.error){ 125 SYS.alert("Erfolgreich","Wir haben Ihre Nachricht erhalten und werden uns schnellstmöglich bei Ihnen persönlich melden.",function(){ 126 location.reload(); 127 }); 128 }else{ 129 if(API.error == "403" || API.error == 403){ 130 SYS.alert("Fehlgeschlagen","Es liegt ein technischer Fehler vor. Die Nachricht konnte nicht zugestellt werden. Versuchen Sie es später noc
130h einmal.",false); 131 } 132 else if(API.error == "503" || API.error == 503){ 133 SYS.alert("Fehlgeschlagen","Sie ein wenig warten, bevor Sie erneut eine Nachricht senden können. Dies soll Spam vorbeugen. Versuchen Sie es später noch einmal.",false); 134 } 135 } 136 } 137 }); 138 139 } 140$(document).ready(function(){ 141 FORMS.Init(); 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.