File "wpforms-modern.min.js"

Full Path: /home/ycoalition/public_html/blog/wp-admin/js/widgets/plugins/wpforms-lite/assets/js/wpforms-modern.min.js
File size: 5.63 KB
MIME-type: text/plain
Charset: utf-8

"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(`.wpforms-page-indicator-page-${e} .wpforms-page-indicator-page-title`).text(),r=o?o+". "+r:r,a.attr("aria-valuenow",e),i.screenReaderAnnounce(r,"polite")}},screenReaderAnnounce:function(r,o){var e=n.createElement("div"),t="wpforms-screen-reader-announce-"+Date.now();e.setAttribute("id",t),e.setAttribute("aria-live",o||"polite"),e.classList.add("wpforms-screen-reader-announce");let a=n.body.appendChild(e);setTimeout(function(){a.innerHTML=r},100),setTimeout(function(){n.body.removeChild(a)},1e3)},getColorWithOpacity:function(r,o){r=r.trim();var e=i.getColorAsRGBArray(r);if(!e)return r;o=o&&0!==o.length?o.toString():"1";r=4===e.length?parseFloat(e[3]):1,o=parseFloat(o)*r;return`rgba(${e[0]},${e[1]},${e[2]},${o})`.replace(/\s+/g,"")},getSolidColor:function(r){r=r.trim();var o=i.getColorAsRGBArray(r);return o?`rgb(${o[0]},${o[1]},${o[2]})`:r},isValidColor:function(r){var o=(new Option).style;return o.color=r,""!==o.color},getColorAsRGBArray:function(r){if(!i.isValidColor(r))return!1;r=r.replace(/^#/,"");let o;return r.match(/[0-9a-f]{6,8}$/gi)?(o=r.match(/\w\w/g).map(r=>parseInt(r,16)))[3]=o[3]?(o[3]/255).toFixed(2):1:o=r.split("(")[1].split(")")[0].split(","),o},getCssVar:function(r,o){if(!r||"function"!=typeof r.getPropertyValue)return null;let e=r.getPropertyValue(o).trim();return e=o.includes("color")?e.replace(/\s/g,""):e},getCssVars:function(r){if(!r||!r.length)return null;for(var r=r.hasClass("wpforms-container")?r:r.closest(".wpforms-container"),o=getComputedStyle(r.get(0)),e=wpforms_settings.css_vars,t={},a=0;a<e.length;a++)t[e[a]]=i.getCssVar(o,"--wpforms-"+e[a]);return t}};return i}(document,(window,jQuery)),WPForms.FrontendModern.init();