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
5.6 KiB
JavaScript
1 line
5.6 KiB
JavaScript
7 months ago
|
"use strict";var WPForms=window.WPForms||{};WPForms.FrontendModern=WPForms.FrontendModern||function(n,o){let i={init:function(){o(i.ready)},ready:function(){i.updateGBBlockAccentColors(),i.initPageBreakButtons(),i.events()},events:function(){o(n).on("wpforms_elementor_form_fields_initialized",i.initPageBreakButtons),o("form.wpforms-form").on("wpformsCombinedUploadsSizeError",i.combinedUploadsSizeError).on("wpformsFormSubmitButtonDisable",i.formSubmitButtonDisable).on("wpformsFormSubmitButtonRestore",i.formSubmitButtonRestore).on("wpformsPageChange",i.pageChange),o("form.wpforms-form .wpforms-submit").on("keydown click",i.disabledButtonPress)},updateGBBlockAccentColors:function(){o(".wpforms-block.wpforms-container-full, .elementor-widget-wpforms .wpforms-container-full").each(function(){var r=o(this);i.updateGBBlockPageIndicatorColor(r),i.updateGBBlockIconChoicesColor(r),i.updateGBBlockRatingColor(r)})},updateGBBlockPageIndicatorColor:function(r){var r=r.find(".wpforms-page-indicator"),o=r.find(".wpforms-page-indicator-page-progress, .wpforms-page-indicator-page.active .wpforms-page-indicator-page-number"),e=o.find(".wpforms-page-indicator-page-triangle");r.data("indicator-color","var( --wpforms-button-background-color )"),o.css("background-color","var( --wpforms-button-background-color )"),e.css("border-top-color","var( --wpforms-button-background-color )")},updateGBBlockPageIndicatorColorF:function(r){var o,e,r=r.querySelector(".wpforms-page-indicator");r&&(e=(o=r.querySelector(".wpforms-page-indicator-page-progress, .wpforms-page-indicator-page.active .wpforms-page-indicator-page-number")).querySelector(".wpforms-page-indicator-page-triangle"),r.dataset.indicatorColor="var( --wpforms-button-background-color )",o&&o.style.setProperty("background-color","var( --wpforms-button-background-color )"),e)&&e.style.setProperty("border-top-color","var( --wpforms-button-background-color )")},updateGBBlockIconChoicesColor:function(r){r.find(".wpforms-icon-choices").css("--wpforms-icon-choices-color","var( --wpforms-button-background-color )")},updateGBBlockRatingColor:function(r){r.find(".wpforms-field-rating-item svg").css("color","var( --wpforms-button-background-color )")},initPageBreakButtons(){o(".wpforms-page-button").removeClass("wpforms-disabled").attr("aria-disabled","false").attr("aria-describedby","")},combinedUploadsSizeError:function(r,o,e){var t=o.data("formid"),a=o.attr("aria-errormessage")||"",t=`wpforms-${t}-footer-error`,n=o.find(".wpforms-submit");o.attr({"aria-invalid":"true","aria-errormessage":a+" "+t}),e.attr({role:"alert",id:t}),e.find("> .wpforms-hidden:first-child").remove(),e.prepend(`<span class="wpforms-hidden">${wpforms_settings.formErrorMessagePrefix}</span>`),n.attr("aria-describedby",t)},combinedUploadsSizeOk:function(r,o,e){console.warn('WARNING! Function "WPForms.FrontendModern( e, $form, $errorCnt )" has been deprecated, please use the new "formSubmitButtonDisable: function( e, $form, $submitBtn )" function instead!'),o.find(".wpforms-submit").removeClass("wpforms-disabled").attr("aria-disabled","false").attr("aria-describedby","")},formSubmitButtonDisable:function(r,o,e){o=o.attr("id")+"-submit-btn-disabled";e.before(`<div class="wpforms-hidden" id="${o}">${wpforms_settings.submitBtnDisabled}</div>`),e.prop("disabled",!1).addClass("wpforms-disabled").attr("aria-disabled","true").attr("aria-describedby",o)},formSubmitButtonRestore:function(r,o,e){var t=o.attr("id")+"-submit-btn-disabled";o.find("#"+t).remove(),e.removeClass("wpforms-disabled").attr("aria-disabled","false").attr("aria-describedby","")},disabledButtonPress:function(r){!o(this).hasClass("wpforms-disabled")||"Enter"!==r.key&&"click"!==r.type||(r.preventDefault(),r.stopPropagation())},pageChange:function(r,e,t){var a=t.find(".wpforms-page-indicator");if(wpforms_settings.indicatorStepsPattern&&a.length){t=t.find(".wpforms-page").length;let r=wpforms_settings.indicatorStepsPattern,o;r=r.replace("{current}",e).replace("{total}",t),o=a.hasClass("progress")?a.find(".wpforms-page-indicator-page-title").data(`page-${e}-title`):a.find(`.wp
|