Viewing File: /home/fshjisk/atelierdemila/wp-content/plugins/fusion-builder/assets/js/min/general/fusion-form.js
window.fusionForms={onLoad:function(){setTimeout(function(){window.fusionForms.calcSelectArrowDimensions()},100),jQuery(".fusion-form-recaptcha-v2").length&&window.fusionForms.renderRecaptcha(),window.fusionForms.calcTooltipWidth(),jQuery("#fusion-form-preview").length||jQuery.each(jQuery(".fusion-form-builder"),function(e,o){window.fusionForms.ajaxUpdateView(this)})},onReady:function(){window.fusionForms.startFlatpickr(),jQuery(".fusion-form-range-field-container").on("change input",function(e){var o=jQuery(e.target),r=parseInt(o.attr("max")),i=parseInt(o.attr("min")),t=parseInt(o.val()),n=o.hasClass("fusion-form-range-value")?".fusion-form-input":".fusion-form-range-value";(t<i||t>r)&&(t=t<i?i:r,o.val(t)),o.siblings(n).val(t)}),jQuery(".fusion-form-upload-field-button").click(function(e){e.preventDefault(),jQuery(this).closest(".fusion-form-upload-field-container").find('input[type="file"]').trigger("click")}),jQuery('.fusion-form-upload-field-container input[type="file"]').change(function(){window.fusionForms.fileUploadChange(this)}),jQuery(".form-form-submit").click(function(e){window.fusionForms.submitClick(e,this)}),jQuery("form.fusion-form").on("submit",function(e){window.fusionForms.submitForm(e,this)}),jQuery("body").on("click",".fusion-alert .close",function(e){e.preventDefault(),jQuery(this).parent().slideUp()}),jQuery(".fusion-form-field input, .fusion-form-field textarea").on("blur",function(){var e=jQuery(this).closest(".fusion-form-field");e.hasClass("error")&&this.checkValidity()&&e.removeClass("error")}),jQuery(".fusion-form-upload-field").on("drag dragstart dragend dragover dragenter dragleave drop",function(e){e.preventDefault(),e.stopPropagation()}).on("dragover dragenter",function(){jQuery(this).addClass("focused")}).on("dragleave dragend drop",function(){jQuery(this).removeClass("focused")}).on("drop",function(e){var o=e.originalEvent.dataTransfer.files;jQuery(this).find('input[type="file"]').prop("files",o).trigger("change")})},startFlatpickr:function(){jQuery('.fusion-form-field input[type="date"]').each(function(){var e=jQuery(this),o=e.attr("data-type"),r="custom"===o;"native"!==o&&e.flatpickr({allowInput:!0,disableMobile:r})}),jQuery('.fusion-form-field input[type="time"]').each(function(){var e=jQuery(this),o=e.attr("data-type"),r="custom"===o,i="full"===e.attr("data-clock");"native"!==o&&e.flatpickr({allowInput:!0,disableMobile:r,enableTime:!0,noCalendar:!0,dateFormat:"H:i",time_24hr:i})})},renderRecaptcha:function(){var e;jQuery.each(jQuery(".fusion-form-recaptcha-v2"),function(o,r){e=jQuery(this).attr("id"),grecaptcha.render(e,{sitekey:jQuery(this).data("sitekey"),type:jQuery(this).data("type"),theme:jQuery(this).data("theme")})})},calcTooltipWidth:function(){jQuery.each(jQuery(".fusion-form-tooltip-content"),function(e,o){var r;jQuery(o).closest(".fusion-form-tooltip").css({position:"inherit"}),r=jQuery(o).width()+23,jQuery(o).css({width:r+"px"}),jQuery(o).closest(".fusion-form-tooltip").removeAttr("style")})},calcSelectArrowDimensions:function(){jQuery(".fusion-form-select-wrapper .select-arrow").filter(":visible").each(function(){0<jQuery(this).prev().innerHeight()&&jQuery(this).css({height:jQuery(this).prev().innerHeight(),width:jQuery(this).prev().innerHeight(),"line-height":jQuery(this).prev().innerHeight()+"px"})})},withinViewport:function(e){var o=e.offset().top,r=o+e.outerHeight(),i=jQuery(window).scrollTop(),t=i+jQuery(window).height();return r>i&&o<t},submitClick:function(e,o){var r,i=jQuery(o).closest("form.fusion-form"),t=jQuery(o).data("form-number"),n=[];"default"!==window["formCreatorConfig_"+t].form_type&&(e.preventDefault(),i.find('[data-holds-private-data="true"]').each(function(e,o){n.push(o.name)}),i.find('[name="fusion-fields-hold-private-data"]').length||i.append('<input type="hidden" name="fusion-fields-hold-private-data" value="'+n.join(",")+'">'),setTimeout(function(){i.trigger("submit"),r=new CustomEvent("fusion-form-submit",{detail:{event:e,form:i}}),window.dispatchEvent(r)},50))},submitForm:function(e,o){var r=jQuery(o),i=r.find(".form-form-submit").data("form-number"),t=window["formCreatorConfig_"+i];if("default"!==t.form_type){if(e.preventDefault(),r.find(".fusion-form-field.error").removeClass("error"),!r[0].checkValidity())return r[0].reportValidity(),void r.find("input:invalid, textarea:invalid").each(function(){jQuery(this).closest(".fusion-form-field").addClass("error")});0==r.find(".error:not(.fusion-alert)").length&&window.fusionForms.ajaxSubmit(r,t)}},getFormData:function(e,o){var r,i,t=new FormData,n=e.find('input[type="file"]'),a=e.serializeArray(),f=e.parent().data("form-id");for(n.length&&n.each(function(){var e=jQuery(this).attr("name");jQuery.each(this.files,function(o,r){t.append("files["+e+"]",r)})}),r=0,i=a.length;r<i;r++)a[r].value=jQuery.trim(a[r].value);return t.append("formData",jQuery.param(a)),t.append("action","fusion_form_submit_form_to_"+o.form_type),t.append("fusion_form_nonce",e.find("#fusion-form-nonce-"+f).val()),t.append("form_id",o.form_id),t.append("post_id",o.post_id),t.append("field_labels",JSON.stringify(o.field_labels)),e.find(".fusion-form-recaptcha-v2").length&&t.append("g-recaptcha-response",e.find("#g-recaptcha-response").val()),e.find(".fusion-form-recaptcha-v3").length&&t.append("g-recaptcha-response",e.find(".g-recaptcha-response").val()),"url"===o.form_type&&(t.append("fusionAction",e.attr("action")),t.append("fusionActionMethod",e.attr("method"))),t},ajaxSubmit:function(e,o){var r=this;e.find(".form-form-submit").addClass("fusion-form-working"),jQuery.ajax({type:"POST",url:formCreatorConfig.ajaxurl,data:window.fusionForms.getFormData(e,o),action:"fusion_form_submit_form_to_"+o.form_type,dataType:"json",processData:!1,contentType:!1}).done(function(i){i.captcha||jQuery(e)[0].reset(),"success"==i.status&&"redirect"==o.confirmation_type&&""!==o.redirect_url?window.location=o.redirect_url:r.revealAlert(e,i.status)}).fail(function(){r.revealAlert(e,"error")}).always(function(){e.find(".form-form-submit").removeClass("fusion-form-working")})},revealAlert:function(e,o){var r=e.find(".form-submission-notices"),i=r.find(" > .fusion-form-response-"+o);r.find(".fusion-form-response").hide(),i.length&&(this.withinViewport(r)?i.slideDown(300):(i.css({display:"block"}),jQuery(".fusion-page-load-link").attr("href","#"+r.attr("id")).fusion_scroll_to_anchor_target(30)))},ajaxUpdateView:function(e){jQuery.ajax({type:"POST",url:formCreatorConfig.ajaxurl,data:{action:"fusion_form_update_view",form_id:jQuery(e).data("form-id")},success:function(o){jQuery(e).find(".fusion-form").append(o)},dataType:"html"})},fileUploadChange:function(e){var o=jQuery(e),r=o.val(),i=o.attr("accept"),t=(jQuery(e).prop("files")[0].size/1024/1024).toFixed(4),n=o.data("size"),a=o.closest(".fusion-form-upload-field"),f=r.match(/\.([^\.]+)$/)[1].toLowerCase();return a.removeClass("error"),void 0===i||i.toLowerCase().includes(f)?void 0!==n&&t>n?(a.find('input[type="text"]').val(formCreatorConfig.file_size_error+n+"MB"),a.addClass("error"),void o.val("")):void o.closest(".fusion-form-upload-field-container").find(".fusion-form-upload-field").val(o.val().split("\\").pop()).trigger("change"):(a.find('input[type="text"]').val(formCreatorConfig.file_ext_error+i),a.addClass("error"),void o.val(""))}},function(e){e(window).on("load",function(){window.fusionForms.onLoad()}),e(document).ready(function(){window.fusionForms.onReady()}),e(window).on("fusion-element-render-fusion_form",function(){window.fusionForms.startFlatpickr()})}(jQuery);
Back to Directory
File Manager