game/kula153/js/gravityforms.min.js

1 line
43 KiB
JavaScript
Raw Normal View History

2022-12-19 20:22:19 +00:00
var gform=window.gform||{};function announceAJAXValidationErrors(){jQuery(".gform_validation_errors").length&&(jQuery("#gf_form_focus").focus(),setTimeout(function(){wp.a11y.speak(jQuery(".gform_validation_errors > h2").text())},1e3))}function gformBindFormatPricingFields(){jQuery(".ginput_amount, .ginput_donation_amount").off("change.gform").on("change.gform",function(){gformFormatPricingField(this)}),jQuery(".ginput_amount, .ginput_donation_amount").each(function(){gformFormatPricingField(this)})}function Currency(e){this.currency=e,this.toNumber=function(e){return this.isNumeric(e)?parseFloat(e):gformCleanNumber(e,this.currency.symbol_right,this.currency.symbol_left,this.currency.decimal_separator)},this.toMoney=function(e,t){if(!1===(e=!(t=t||!1)?gformCleanNumber(e,this.currency.symbol_right,this.currency.symbol_left,this.currency.decimal_separator):e))return"";"-"==(e+=negative="")[0]&&(e=parseFloat(e.substr(1)),negative="-"),money=this.numberFormat(e,this.currency.decimals,this.currency.decimal_separator,this.currency.thousand_separator),"0.00"==money&&(negative="");t=this.currency.symbol_left?this.currency.symbol_left+this.currency.symbol_padding:"",e=this.currency.symbol_right?this.currency.symbol_padding+this.currency.symbol_right:"";return money=negative+this.htmlDecode(t)+money+this.htmlDecode(e),money},this.numberFormat=function(e,t,r,i,n){n=void 0===n||n,e=(e+"").replace(",","").replace(" ","");var o=isFinite(+e)?+e:0,a=isFinite(+t)?Math.abs(t):0,e=void 0===i?",":i,i=void 0===r?".":r,r="";return 3<(r="0"==t?(o+=1e-10,(""+Math.round(o)).split(".")):(-1==t?""+o:function(e,t){t=Math.pow(10,t);return""+Math.round(e*t)/t}(o+=1e-10,a)).split("."))[0].length&&(r[0]=r[0].replace(/\B(?=(?:\d{3})+(?!\d))/g,e)),n&&(r[1]||"").length<a&&(r[1]=r[1]||"",r[1]+=new Array(a-r[1].length+1).join("0")),r.join(i)},this.isNumeric=function(e){return gformIsNumber(e)},this.htmlDecode=function(e){var t,r,i=e,n=i.match(/&#[0-9]{1,5};/g);if(null!=n)for(var o=0;o<n.length;o++)i=-32768<=(t=(r=n[o]).substring(2,r.length-1))&&t<=65535?i.replace(r,String.fromCharCode(t)):i.replace(r,"");return i},this.getCode=function(){return"code"in this.currency&&""!==this.currency.code&&this.currency.code}}function gformCleanNumber(e,t,r,i){var n="",o="",a="",l=!1;e=(e=(e=(e+=" ").replace(/&.*?;/g,"")).replace(t,"")).replace(r,"");for(var s=0;s<e.length;s++)a=e.substr(s,1),0<=parseInt(a,10)&&parseInt(a,10)<=9||a==i?n+=a:"-"==a&&(l=!0);for(s=0;s<n.length;s++)"0"<=(a=n.substr(s,1))&&a<="9"?o+=a:a==i&&(o+=".");return!!gformIsNumber(o=l?"-"+o:o)&&parseFloat(o)}function gformGetDecimalSeparator(e){switch(e){case"currency":var t=new Currency(gf_global.gf_currency_config).currency.decimal_separator;break;case"decimal_comma":t=",";break;default:t="."}return t}function gformIsNumber(e){return!isNaN(parseFloat(e))&&isFinite(e)}function gformIsNumeric(e,t){switch(t){case"decimal_dot":return new RegExp("^(-?[0-9]{1,3}(?:,?[0-9]{3})*(?:.[0-9]+)?)$").test(e);case"decimal_comma":return new RegExp("^(-?[0-9]{1,3}(?:.?[0-9]{3})*(?:,[0-9]+)?)$").test(e)}return!1}function gformDeleteUploadedFile(e,t,r){var i=jQuery("#field_"+e+"_"+t),n=jQuery(r).parent().index();i.find(".ginput_preview").eq(n).remove(),i.find('input[type="file"],.validation_message,#extensions_message_'+e+"_"+t).removeClass("gform_hidden"),i.find(".ginput_post_image_file").show(),i.find('input[type="text"]').val("");var o=jQuery("#gform_uploaded_files_"+e).val();!o||(r=jQuery.secureEvalJSON(o))&&(o="input_"+t,0<(t=i.find("#gform_multifile_upload_"+e+"_"+t)).length?(r[o].splice(n,1),t=(n=t.data("settings")).gf_vars.max_files,jQuery("#"+n.gf_vars.message_id).html(""),r[o].length<t&&gfMultiFileUploader.toggleDisabled(n,!1)):r[o]=null,jQuery("#gform_uploaded_files_"+e).val(jQuery.toJSON(r)))}void 0===jQuery.fn.prop&&(jQuery.fn.prop=jQuery.fn.attr),jQuery(document).on("gform_post_render",announceAJAXValidationErrors),jQuery(document).bind("gform_post_render",gformBindFormatPricingFields),gform.instances={},gform.console={error:function(e){window.console&&console.error(e)},info:function(e){window.console&&cons