You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1 line
38 KiB
JavaScript
1 line
38 KiB
JavaScript
7 months ago
|
"use strict";var wpforms=window.wpforms||function(i,s,l){var p={cache:{},init:function(){l(p.ready),l(s).on("load",function(){"function"==typeof l.ready.then?l.ready.then(p.load):p.load()}),p.bindUIActions(),p.bindOptinMonster()},ready:function(){p.clearUrlQuery(),p.setUserIndentifier(),p.loadValidation(),p.loadDatePicker(),p.loadTimePicker(),p.loadInputMask(),p.loadSmartPhoneField(),p.loadPayments(),p.loadMailcheck(),p.loadChoicesJS(),l(".wpforms-randomize").each(function(){for(var e=l(this),t=e.children();t.length;)e.append(t.splice(Math.floor(Math.random()*t.length),1)[0])}),l(".wpforms-page-button").prop("disabled",!1),l(i).trigger("wpformsReady")},load:function(){},clearUrlQuery:function(){var e=s.location,t=e.search;-1!==t.indexOf("wpforms_form_id=")&&(t=t.replace(/([&?]wpforms_form_id=[0-9]*$|wpforms_form_id=[0-9]*&|[?&]wpforms_form_id=[0-9]*(?=#))/,""),history.replaceState({},null,e.origin+e.pathname+t))},loadValidation:function(){void 0!==l.fn.validate&&(l(".wpforms-input-temp-name").each(function(e,t){var r=Math.floor(9999*Math.random())+1;l(this).attr("name","wpf-temp-"+r)}),l(i).on("change",".wpforms-validate input[type=url]",function(){var e=l(this).val();if(!e)return!1;"http://"!==e.substr(0,7)&&"https://"!==e.substr(0,8)&&l(this).val("https://"+e)}),l.validator.messages.required=wpforms_settings.val_required,l.validator.messages.url=wpforms_settings.val_url,l.validator.messages.email=wpforms_settings.val_email,l.validator.messages.number=wpforms_settings.val_number,void 0!==l.fn.payment&&l.validator.addMethod("creditcard",function(e,t){e=l.payment.validateCardNumber(e);return this.optional(t)||e},wpforms_settings.val_creditcard),l.validator.addMethod("extension",function(e,t,r){return r="string"==typeof r?r.replace(/,/g,"|"):"png|jpe?g|gif",this.optional(t)||e.match(new RegExp("\\.("+r+")$","i"))},wpforms_settings.val_fileextension),l.validator.addMethod("maxsize",function(e,t,r){var a,o,n=r,r=this.optional(t);if(r)return r;if(t.files&&t.files.length)for(a=0,o=t.files.length;a<o;a++)if(t.files[a].size>n)return!1;return!0},wpforms_settings.val_filesize),l.validator.addMethod("step",function(e,t,r){n=r;const a=Math.floor(n)!==n&&n.toString().split(".")[1].length||0;function o(e){return Math.round(e*Math.pow(10,a))}var n=o(l(t).attr("min"));return e=o(e)-n,this.optional(t)||o(e)%o(r)==0}),l.validator.methods.email=function(e,t){return this.optional(t)||function(e){if("string"!=typeof e)return!1;var t=e.indexOf("@",1);if(e.length<6||254<e.length||-1===t)return!1;if(-1!==e.indexOf("@",t+1))return!1;var[t,e]=e.split("@");if(!t||!e)return!1;if(!/^[a-zA-Z0-9!#$%&'*+/=?^_`{|}~.-]+$/.test(t)||63<t.length)return!1;if(/\.{2,}/.test(e)||e.trim(" \t\n\r\0\v.")!==e)return!1;t=e.split(".");if(t.length<2)return!1;var r=/^[a-z0-9-]+$/i;for(const a of t)if(63<a.length||a.trim(" \t\n\r\0\v-")!==a||!r.test(a))return!1;return!0}(e)},l.validator.addMethod("restricted-email",function(e,t){var r=l(t);return!r.val().length||(r=r.closest(".wpforms-form").data("formid"),Object.prototype.hasOwnProperty.call(p.cache,r)&&Object.prototype.hasOwnProperty.call(p.cache[r],"restrictedEmailValidation")&&Object.prototype.hasOwnProperty.call(p.cache[r].restrictedEmailValidation,e)?p.cache[r].restrictedEmailValidation[e]:(p.restrictedEmailRequest(t,e),"pending"))},wpforms_settings.val_email_restricted),l.validator.addMethod("confirm",function(e,t,r){t=l(t).closest(".wpforms-field");return l(t.find("input")[0]).val()===l(t.find("input")[1]).val()},wpforms_settings.val_confirm),l.validator.addMethod("required-payment",function(e,t){return 0<p.amountSanitize(e)},wpforms_settings.val_requiredpayment),l.validator.addMethod("time12h",function(e,t){return this.optional(t)||/^((0?[1-9]|1[012])(:[0-5]\d){1,2}(\ ?[AP]M))$/i.test(e)},wpforms_settings.val_time12h),l.validator.addMethod("time24h",function(e,t){return this.optional(t)||/^(([0-1]?[0-9])|([2][0-3])):([0-5]?[0-9])(\ ?[AP]M)?$/i.test(e)},wpforms_settings.val_time24h),l.validator.addMethod("turnstile",function(e){return e},wpforms_settings.val_turnstile_fail_msg),l.validator.addMethod("time-limit
|