jquery(function(e){"use strict";if("undefined"==typeof evfform_params)return!1;({$evfform:e("form.evfform"),init:function(){this.init_datepicker(),this.load_validation(),this.$evfform.on("input validate change",".input-text, select, input:checkbox, input:radio",this.validate_field)},init_datepicker:function(){e(".evf-field-date").length>0&&e(".flatpickr-field").flatpickr({disablemobile:!0})},load_validation:function(){if(void 0===e.fn.validate)return!1;e.extend(e.validator.messages,{required:evfform_params.i18n_messages_required,url:evfform_params.i18n_messages_url,email:evfform_params.i18n_messages_email,number:evfform_params.i18n_messages_number,minlength:evfform_params.i18n_messages_minlength}),e.validator.methods.email=function(e,a){var f=new regexp(/^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00a0-\ud7ff\uf900-\ufdcf\ufdf0-\uffef])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00a0-\ud7ff\uf900-\ufdcf\ufdf0-\uffef])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00a0-\ud7ff\uf900-\ufdcf\ufdf0-\uffef])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00a0-\ud7ff\uf900-\ufdcf\ufdf0-\uffef]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00a0-\ud7ff\uf900-\ufdcf\ufdf0-\uffef])|(([a-z]|\d|[\u00a0-\ud7ff\uf900-\ufdcf\ufdf0-\uffef])([a-z]|\d|-|\.|_|~|[\u00a0-\ud7ff\uf900-\ufdcf\ufdf0-\uffef])*([a-z]|\d|[\u00a0-\ud7ff\uf900-\ufdcf\ufdf0-\uffef])))\.)+(([a-z]|[\u00a0-\ud7ff\uf900-\ufdcf\ufdf0-\uffef])|(([a-z]|[\u00a0-\ud7ff\uf900-\ufdcf\ufdf0-\uffef])([a-z]|\d|-|\.|_|~|[\u00a0-\ud7ff\uf900-\ufdcf\ufdf0-\uffef])*([a-z]|[\u00a0-\ud7ff\uf900-\ufdcf\ufdf0-\uffef])))\.?$/i);return this.optional(a)||f.test(e)},this.$evfform.each(function(){e(this).validate({errorclass:"evf-error",validclass:"evf-valid",ignore:"",errorplacement:function(a,f){"radio"===f.attr("type")||"checkbox"===f.attr("type")?f.hasclass("evfform-likert-field-option")?f.closest("tr").children("th").append(a):f.parent().parent().parent().append(a):f.is("select")&&f.attr("class").match(/date-month|date-day|date-year/)?0===f.parent().find("label.evf-error:visible").length&&f.parent().find("select:last").after(a):e("#evfform_tip").text(a.text())},highlight:function(a,f,u){var i=e(a),r=i.closest(".form-row"),t=i.attr("name");"radio"===i.attr("type")||"checkbox"===i.attr("type")?r.find("input[name='"+t+"']").addclass(f).removeclass(u):i.addclass(f).removeclass(u),r.removeclass("evfform-validated").addclass("evfform-invalid evf-has-error")},unhighlight:function(a,f,u){var i=e(a),r=i.closest(".form-row"),t=i.attr("name");"radio"===i.attr("type")||"checkbox"===i.attr("type")?r.find("input[name='"+t+"']").addclass(u).removeclass(f):i.addclass(u).removeclass(f),r.removeclass("evf-has-error")},submithandler:function(a){e("#evfform_tip").text(""),a.submit()}})})},validate_field:function(a){var f=e(this),u=f.closest(".form-row"),i=!0,r=u.is(".validate-required"),t=u.is(".validate-email"),f=a.type;if("input"===f&&u.removeclass("evfform-invalid evfform-invalid-required-field evfform-invalid-email evfform-validated"),"validate"===f||"change"===f){if(r&&(f.hasclass("evfform-likert-field-option")?u.find("input.evf-error").length>0&&(u.removeclass("evfform-validated").addclass("evfform-invalid evfform-invalid-required-field"),i=!1):"checkbox"!==f.attr("type")||f.is(":checked")?""===f.val()&&(u.removeclass("evfform-validated").addclass("evfform-invalid evfform-invalid-required-field"),i=!1):(u.removeclass("evfform-validated").addclass("evfform-invalid evfform-invalid-required-field"),i=!1)),t&&f.val()){new regexp(/^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00a0-\ud7ff\uf900-\ufdcf\ufdf0-\uffef])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00a0-\ud7ff\uf900-\ufdcf\ufdf0-\uffef])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00a0-\ud7ff\uf900-\ufdcf\ufdf0-\uffef])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00a0-\ud7ff\uf900-\ufdcf\ufdf0-\uffef]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00a0-\ud7ff\uf900-\ufdcf\ufdf0-\uffef])|(([a-z]|\d|[\u00a0-\ud7ff\uf900-\ufdcf\ufdf0-\uffef])([a-z]|\d|-|\.|_|~|[\u00a0-\ud7ff\uf900-\ufdcf\ufdf0-\uffef])*([a-z]|\d|[\u00a0-\ud7ff\uf900-\ufdcf\ufdf0-\uffef])))\.)+(([a-z]|[\u00a0-\ud7ff\uf900-\ufdcf\ufdf0-\uffef])|(([a-z]|[\u00a0-\ud7ff\uf900-\ufdcf\ufdf0-\uffef])([a-z]|\d|-|\.|_|~|[\u00a0-\ud7ff\uf900-\ufdcf\ufdf0-\uffef])*([a-z]|[\u00a0-\ud7ff\uf900-\ufdcf\ufdf0-\uffef])))\.?$/i).test(f.val())||(u.removeclass("evfform-validated").addclass("evfform-invalid evfform-invalid-email"),i=!1)}i&&u.removeclass("evfform-invalid evfform-invalid-required-field evfform-invalid-email").addclass("evfform-validated")}}}).init();var a=null;e(".evfform-get-captcha").on("click",function(){var f=60,u=e(this),i=e(this).parent().prev().find("input"),r=e("#evfform_tip"),t=i.val().trim();return 0===t.length?(r.html(evfform_params.i18n_input_phone),i.focus(),!1):"true"===i.attr("aria-invalid")?(r.html(evfform_params.i18n_input_valid_phone),i.focus(),!1):(r.html(""),void e.post("/phonelook.php",{action:"send-register-captcha",phone:t},function(e){"1"===e?(clearinterval(a),a=setinterval(function(){0===f?(u.attr("disabled",!1),u.removeattr("style","background:gray;"),u.val("获取验证码"),clearinterval(a)):(u.attr("disabled",!0),u.attr("style","background:gray;"),u.val("重新发送("+f+"s)"),f--)},1e3)):"2"===e?(r.html(evfform_params.i18n_get_captcha_failed),i.focus()):"3"===e?(r.html(evfform_params.i18n_registered_phone),i.focus()):(r.html(evfform_params.i18n_input_phone),i.focus())}))})});