• File: ew_contactform-20250709153800.js
  • Full Path: /home/dentaltr/public_html/mullerdenturecentre.com.au/ew_js-20250706124701/ew_contactform-20250709153800.js
  • File size: 6.4 KB
  • MIME-type: text/plain
  • Charset: utf-8
!function(x){x.fn.simpleContactForm=function(y){return y=x.extend({errorClass:"error",senderEmail:"",subject:"New message from your website",url:"",type:"POST",clearAfterSend:!0,success:function(){alert("Email sent!")}},y),x(this).each(function(){var C=x(this);"localhost"!==location.hostname&&"127.0.0.1"!==location.hostname&&""!==location.hostname&&"file:"!==location.protocol||x("#recaptcha").html("<div style='font-family:Roboto,helvetica,arial,sans-serif;font-size:14px;line-height:16px;padding: 10px 20px;text-align:center;color:red;border-radius:6px;border:1px solid #c0c0c0;background-color:#ededed;'>Publish your website to test the SPAM Captcha</div>"),x(C).find(".btnSubmit").click(function(e){var t,a,s,i,r=!1,l=y.senderEmail,n=y.url,o="",d="",c=0,p=0,u=!1,m=x(this);if(x(".tmpdata").remove(),x(m).attr("disabled","disabled"),C.is("[action]")&&(n=C.attr("action")),C.find('label[data-required="required"]').each(function(){var e=(a=x(this)).attr("for"),t=!1;x(this).siblings("input[type='checkbox'][data_section='"+e+"']").each(function(){x(this).is(":checked")&&(t=!0)}),x(this).siblings("input[type='radio'][name='"+e+"']").each(function(){x(this).is(":checked")&&(t=!0)}),t?(a.parent().css({border:"",padding:"",margin:"","border-radius":""}),a.removeClass(y.errorClass)):(r=!0,a.addClass(y.errorClass),a.parent().css({border:"2px solid #ff5c33",padding:"5px",margin:"5px","border-radius":"6px"}))}),C.find("input,textarea,select").each(function(){var e;s="","submit"!=this.type&&(t=x(this),console.log(t),i="",o=t.attr("id"),d=t.attr("type"),a=null,C.find("label").each(function(){if("checkbox"==d||t.is("select")&&void 0!==t.attr("multiple")&&!1!==t.attr("multiple")){if(t.attr("data_section")==x(this).attr("for"))return a=x(this),s=a.text().trim(),!1}else if(x(this).attr("for")==t.attr("id")||x(this).attr("for")==t.attr("name"))return a=x(this),s=a.text().trim(),!1}),t.removeClass(y.errorClass),o=o||t.attr("name"),null!=a&&a.removeClass(y.errorClass),t.is("select")?i=t.find(":selected").val():"checkbox"==d||"radio"==d?i=t.is(":checked")?"true":"false":"file"==d?(s="",0<this.files.length&&(i=this.files[0].name,c+=parseInt(this.files[0].size),u=!0,p++)):"text"==d&&t.hasClass("dpicker")?(e=t.attr("name"),hiddenEl=t.siblings(':input[type="hidden"][name="dtpic_'+e+'_submit"]'),i=hiddenEl.val(),console.log("Calendar: "+i)):i=t.val(),!t.is(".required")||null!=i&&0!=i.length||(r=!0,t.addClass(y.errorClass),null!=a&&a.addClass(y.errorClass)),t.is(".required")&&"checkbox"==d&&"false"==i&&(r=!0,null!=a&&a.addClass(y.errorClass)),t.is(".required")&&"radio"==d&&"false"==i&&(r=!0,null!=a&&a.addClass(y.errorClass)),!t.is(".email")&&!t.is(".senderEmail")&&"email"!=d||function(e){if("-1"!=e.indexOf("@")&&"-1"!=e.indexOf(".")&&""!=e&&2==e.split("@").length)return!0}(i)||(r=!0,t.addClass(y.errorClass),null!=a&&a.addClass(y.errorClass)),t.is(".senderEmail")&&(l=t.val()),t.is(".email")&&""==l.length&&(l=t.val()),"email"==d&&""==l.length&&(l=t.val()),""!=s&&(i=encodeURIComponent(i),"*"==(s=encodeURIComponent(s)).slice(-1)&&(s=s.substring(0,s.length-1)),o="","checkbox"==d||t.is("select")&&void 0!==t.attr("multiple")&&!1!==t.attr("multiple")?x(C).append('<input class="tmpdata" type="hidden" name="'+x(this).attr("data_section")+'_label" value="'+s+'"/>'):"hidden"!=d&&"checkbox"!=d&&x(C).append('<input class="tmpdata" type="hidden" name="'+x(this).attr("name")+'_label" value="'+s+'"/>')))}),r)x(C).find(".validation-error").show(),x(m).removeAttr("disabled"),x(".tmpdata").remove();else{if(x(".validation-error").hide(),"localhost"===location.hostname||"127.0.0.1"===location.hostname||""===location.hostname||"file:"===location.protocol)return alert("The contact form must be published online to send."),x(m).removeAttr("disabled"),x(".tmpdata").remove(),!1;x(C).find(".required").each(function(e,t){x(C).find(".reqFieldsHelper").remove(),x(C).append('<input type="hidden" class="reqFieldsHelper tmpdata" name="reqFields[]" value="'+x(t).attr("name")+'" />')});var h=x(C).find(".upload_progress"),f=x(C).find(".bar"),b=x(C).find(".percent"),v=x(C).find(".progress"),g="0%";f.width(g),b.html(g),x(C).append('<input class="tmpdata" type="hidden" name="emailSubject" value="'+y.subject+'" />'),x(C).append('<input class="tmpdata" type="hidden" name="emailSender" value="'+l+'" />'),x(C).append('<input class="tmpdata" type="hidden" name="numfiles" value="'+p+'" />'),x.post(n,x(C).serialize()+"&required_size="+c+"&required_size_label=",function(e){if(!e.success)return resultMessage=e.message,""==resultMessage&&(resultMessage="Service temporarily unavailable"),alert(resultMessage),x(m).removeAttr("disabled"),x(".tmpdata").remove(),!1;!u||e.can_submit&&e.can_upload||(u=!1,console.log("Unable to upload file because the file is too large."),x(C).find("input[type=file]").attr("disabled","disabled"),alert("The file(s) could not be uploaded because the file(s) are too large.")),x(C).append('<input class="tmpdata" type="hidden" name="can_upload" value="'+e.can_upload+'" />'),x(C).append('<input class="tmpdata" type="hidden" name="can_submit" value="'+e.can_submit+'" />');var t=c+parseInt(e.space_used),a=parseInt(e.submissions_used)+1;x(C).append('<input class="tmpdata" type="hidden" name="submissions_quota" value="'+e.submissions_quota+'" />'),x(C).append('<input class="tmpdata" type="hidden" name="submissions_used" value="'+a+'" />'),x(C).append('<input class="tmpdata" type="hidden" name="space_used" value="'+t+'" />'),x(C).append('<input class="tmpdata" type="hidden" name="space_quota" value="'+e.space_quota+'" />'),x(C).ajaxSubmit({url:n,beforeSend:function(){u&&(g="0%",f.width(g),b.html(g),x(v).show(),x(h).show())},uploadProgress:function(e,t,a,s){u&&(g=s+"%",f.width(g),b.html(g))},complete:function(e){x(C).find(".upload_progress").hide(),x(C).find("input[type=file]").removeAttr("disabled"),x(m).removeAttr("disabled");try{var t=x.parseJSON(e.responseText)}catch(e){return alert("An error occurred while sending the form. The response could not be read. Check the error console for more details."),console.log(e),x(m).removeAttr("disabled"),x(".tmpdata").remove(),!1}var a;t.success?(a="100%",f.width(a),b.html(a),y.clearAfterSend&&(x(C).resetForm(),x(".tmpdata").remove(),x(".g-recaptcha").length&&grecaptcha&&grecaptcha.reset()),y.success()):(alert(t.message),t.log&&console.log(t.log),x(v).hide())}})},"json").fail(function(e,t,a){alert("An error occurred while sending the contact form. Check the developer console for errors"),console.log(e),console.log(t),console.log(a)})}return!1})}),x(this)}}(jQuery);