PluginProbe
SureForms – Contact Form Builder, AI Forms, Payment Form, Survey & Quiz / 2.10.1
SureForms – Contact Form Builder, AI Forms, Payment Form, Survey & Quiz v2.10.1
2.12.8 2.12.7 2.12.6 2.12.5 2.12.4 2.12.3 2.12.2 2.12.1 2.12.0 2.11.1 2.11.0 2.10.1 2.10.0 2.9.1 2.9.0 2.8.2 2.8.1 2.7.0 2.7.1 2.8.0 trunk 0.0.10 0.0.11 0.0.12 0.0.13 All 98 releases
sureforms / assets / js / minified / frontend.min.js

frontend.min.js in SureForms – Contact Form Builder, AI Forms, Payment Form, Survey & Quiz 2.10.1, at assets/js/minified/frontend.min.js

1 lines 5.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 function addGlobalSrfmObject(e,t){var r=window?.srfm||{};r[e]=t,window.srfm=r}function toggleErrorState(e,t){e.classList.contains("srfm-error")!==t&&(e.classList.toggle("srfm-error",t),e=e.querySelector(".srfm-error-message"))&&(t&&e.hasAttribute("data-srfm-id")?e.id=e.getAttribute("data-srfm-id"):e.removeAttribute("id"))}function srfmSprintfString(e,...r){return 1<r.length?e.replace(/%(\d*)\$s|%s/g,(e,t)=>t?(t=parseInt(t,10)-1)>=r.length?"":String(r[t]):0===r.length?"":String(r[0])):e.replace(/%s/g,()=>0===r.length?"":String(r[0]))}(window.addGlobalSrfmObject=addGlobalSrfmObject)("toggleErrorState",toggleErrorState),addGlobalSrfmObject("srfmSprintfString",srfmSprintfString);let SRFM_CHAR_COUNTER_FIELD_SELECTOR="textarea.srfm-input-textarea, input.srfm-input-input";function updateCharCounter(e){var t,r,o=e.closest(".srfm-block");o&&(o=o.querySelector(SRFM_CHAR_COUNTER_FIELD_SELECTOR))&&(t=e.getAttribute("data-counter-limit"),r=e.getAttribute("data-counter-min"),o=o.value.length,e.textContent=o+"/"+t,r=r&&o<parseInt(r,10),o=t&&o>parseInt(t,10),e.classList.toggle("srfm-char-counter--error",Boolean(r||o)))}function initCharCounters(){document.querySelectorAll(".srfm-char-counter").forEach(updateCharCounter)}document.addEventListener("input",e=>{var e=e.target;e&&"function"==typeof e.matches&&e.matches(SRFM_CHAR_COUNTER_FIELD_SELECTOR)&&(e=e.closest(".srfm-block"))&&(e=e.querySelector(".srfm-char-counter"))&&updateCharCounter(e)}),"loading"===document.readyState?document.addEventListener("DOMContentLoaded",initCharCounters):initCharCounters();let emailElements=document.getElementsByClassName("srfm-input-email-container");if(0<emailElements.length){let e=document.getElementsByClassName("srfm-input-email");e[0].addEventListener("input",e=>{document.querySelector("#srfm-sender-email").value=e.target.value})}let submitButton=document.getElementsByClassName("srfm-button");if(submitButton){let e=getComputedStyle(document.documentElement),t=e.getPropertyValue("--srfm-primary-color"),r=e.getPropertyValue("--srfm-secondary-color");if(""!==t)for(let e=0;e<submitButton.length;e++)submitButton[e].style.backgroundColor=t;if(""!==r)for(let e=0;e<submitButton.length;e++)submitButton[e].style.color=r}function onSuccess(e){0!==e.length&&(document.querySelector("#captcha-error").style.display="none")}function showErrorMessage(e){var{form:e,message:t="",position:r="footer"}=e,e=new CustomEvent("srfm_show_common_form_error",{detail:{form:e,message:t,position:r}});document.dispatchEvent(e)}function showErrorMessageOnRecaptchaError(e){let{containerSelector:t,message:r=""}=e;e=document.querySelectorAll(t);e&&e.forEach(e=>{var t=e.closest(".srfm-form");t&&(showErrorMessage({form:t,message:r}),e.classList.add("captcha-error-added"))})}function onTurnstileError(){showErrorMessageOnRecaptchaError({containerSelector:".cf-turnstile:not(.captcha-error-added)",message:srfm_submit?.messages?.srfm_turnstile_error_message})}function onGCaptchaV2CheckBoxError(){showErrorMessageOnRecaptchaError({containerSelector:'.g-recaptcha[recaptcha-type="v2-checkbox"]:not(.captcha-error-added)',message:srfm_submit?.messages?.srfm_google_captcha_error_message})}function onGCaptchaV3Error(){showErrorMessageOnRecaptchaError({containerSelector:'.g-recaptcha[recaptcha-type="v3-reCAPTCHA"]:not(.captcha-error-added)',message:srfm_submit?.messages?.srfm_google_captcha_error_message})}function onHCaptchaError(){showErrorMessageOnRecaptchaError({containerSelector:".h-captcha:not(.captcha-error-added)",message:srfm_submit?.messages?.srfm_captcha_h_error_message})}(()=>{function a(e){return(e?window.getComputedStyle(e):null)?.backgroundColor||"transparent"}function s(e){let r,o,n;if(e.startsWith("rgb"))[r,o,n]=e.match(/\d+/g).map(Number);else{if(!e.startsWith("#"))return.5;{let t=e.slice(1);6===t.length?[r,o,n]=[0,2,4].map(e=>parseInt(t.substr(e,2),16)):3===t.length&&([r,o,n]=t.split("").map(e=>parseInt(e+e,16)))}}var e=r,t=o,a=n,[e,t,a]=[e,t,a].map(e=>(e/=255)<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4));return.2126*e+.7152*t+.0722*a}function t(e){var o=e.querySelector("form");if(o){var n=(e=>{let t=a(e),r=a(e.parentElement),o="rgba(0, 0, 0, 0)"===t&&t===r;for(;("transparent"===t||o)&&e!==document.documentElement;)e=e.parentElement,t=a(e),r=a(e.parentElement),o="rgba(0, 0, 0, 0)"===t&&t===r,t=o?"transparent":r;var n=s(t);return{color:t,isDark:n<.5}})(e).isDark,n=(n&&e.classList.add("srfm-has-dark-bg"),window.getComputedStyle(e).getPropertyValue("--srfm-color-input-text"));if(!(s(n)<.5)){let t={"--srfm-expandable-menu-background":"#2e2e2e"},r=[];Object.keys(t).forEach(e=>{r.push(`${e}: ${t[e]};`)});n=`.srfm-form-container-${o.getAttribute("form-id")} { ${r.join(" ")} }`;e.querySelector("style").innerHTML+=n}}}function e(){var e;document.getElementById("srfm-single-page-container")&&(e=document.querySelector(".srfm-form-container"))&&"absolute"===window.getComputedStyle(e).position&&(document.querySelector(".srfm-form-wrapper").style.height=e.clientHeight+"px")}addGlobalSrfmObject("getTranslatableString",function(e){return window?.srfm_submit?.messages?.[e]||""}),window.addEventListener("resize",e),window.addEventListener("mousemove",e),window.addEventListener("load",function(){e();{let n=document.querySelector(".srfm-branding");if(n){let o=document.querySelector("form.srfm-form");setInterval(()=>{var e,t,r;"none"===window.getComputedStyle(o).display?n.style.display="none":({opacity:e,visibility:t,display:r}=window.getComputedStyle(n),e<1&&(n.style.opacity=1),"visible"!==t&&(n.style.visibility="visible"),"none"===r&&(n.style.display="block"))},100)}}document.querySelectorAll(".srfm-form-container").forEach(e=>{t(e)})}),addGlobalSrfmObject("handleInstantFormWrapperHeight",e),addGlobalSrfmObject("srfmUtility",{prepareValue(e=[]){return e?.length&&Array.isArray(e)?e.join(" | "):""},extractValue(e=""){return"string"!=typeof e||""===e.trim()?[]:e.split(" | ")},normalizeDashes(e){return"string"!=typeof e||0===e.length?e:e.replace(/[–—−﹘﹣]/g,"-")}})})();