File "modal.min.js"

Full path: C:/Inetpub/vhosts/drshti.com/httpdocs/wp-content/plugins/spectra-pro/assets/js/modal.min.js
File size: 4.24 B (4.24 KB bytes)
MIME-type: text/plain
Charset: utf-8

Download   Open   Edit   Advanced Editor &nnbsp; Back

document.addEventListener("UAGModalEditor",function(e){UAGBModal.init(".uagb-block-"+e.detail.block_id,!0,{...e.detail})}),document.addEventListener("AstraQuickViewForModal",function(e){UAGBModal.init(e.detail.class_name,!1,{...e.detail})}),window.UAGBModal={_getVariables(e){var o=UAGBModal._getDocumentElement();return{document_element:o,modalWrapper:o.querySelector(e),modalPopup:o.querySelector(e+".uagb-modal-popup"),closeModal:o.querySelector(e+" .uagb-modal-popup-close"),bodyWrap:o.querySelector("body"),pageTemplate:o.getElementsByClassName("block-editor-iframe__body")}},_addTriggers(t,e={}){var o=UAGBModal._getVariables(t)["document_element"],o=o.querySelectorAll(t);if(o&&0!==o.length)for(const a of o){const l=a?.querySelector(".uagb-modal-popup");l&&(document.addEventListener("keyup",function(e){var o=a.dataset.escpress;27===e.keyCode&&"enable"===o&&UAGBModal._hide(t,l)}),l.querySelector(t+" .uagb-modal-popup-close").addEventListener("click",function(){"automatic"===e?.modalTrigger&&e?.enableCookies&&"close-action"===e?.setCookiesOn&&UAGBModal._setPopupCookie(t,e.hideForDays),UAGBModal._hide(t,l)}))}},_exitIntent(o,t,a,l){document.addEventListener("mouseleave",function(e){20<e.clientY||UAGBModal._canShow(o,l)&&a&&UAGBModal._show(o,t)})},_canShow(e,o={}){var t=UAGBModal._getCookie("uagb-block-popup-"+e);if(o?.enableCookies){if(void 0!==t&&"automatic"===o?.modalTrigger)return!1}else document.cookie=`uagb-block-popup-${e};max-age=-1`;t=UAGBModal._getVariables(e).modalPopup;return!t||!t.classList.contains("active")},_show(e,o){var{bodyWrap:e,pageTemplate:t}=UAGBModal._getVariables(e),a=document.getElementsByClassName("edit-site");o&&!o.classList.contains("active")&&(o.classList.add("active"),!e||e.classList.contains("hide-scroll")||a?.length||t?.length||e.classList.contains("wp-admin")||e.classList.add("hide-scroll"))},_hide(e,o){var{modalPopup:e,bodyWrap:t}=UAGBModal._getVariables(e);o&&o.classList.contains("active")&&o.classList.remove("active"),e&&e.classList.contains("active")&&e.classList.remove("active"),t&&t.classList.contains("hide-scroll")&&UAGBModal.closeModalScrollCheck(t)},_getDocumentElement(){let e=document;var o=document.querySelectorAll('iframe[name="editor-canvas"]');return e=o?.length&&(o=o?.[0]?.contentWindow?.document||o?.[0]?.contentDocument)?o:e},_afterOpen(e,o){o?.enableCookies&&"page-refresh"===o?.setCookiesOn&&UAGBModal._setPopupCookie(e,o?.hideForDays)},_getCookie(e){e=("; "+document.cookie).split("; "+e+"=");if(2===e.length)return e.pop().split(";").shift()},_setPopupCookie(e,o){void 0===UAGBModal._getCookie("uagb-block-popup-"+e)&&void 0!==o&&(document.cookie=`uagb-block-popup-${e}=true; expires=`+new Date(Date.now()+24*o*60*60*1e3).toUTCString())},triggerAction(o,e,t,a=!1){const{document_element:l,bodyWrap:i}=UAGBModal._getVariables(o);var c=l.querySelectorAll(o);if(c?.length)for(const s of c)if(e=e&&a?e:s.querySelector(".uagb-modal-trigger")){const n=s?.querySelector(".uagb-modal-popup"),r=s.dataset.overlayclick;e.style.pointerEvents="auto",n&&(t||document.body?.appendChild(n),e.addEventListener("click",function(e){e.preventDefault(),UAGBModal._show(o,n)}),"disable"!==r)&&n.addEventListener("click",function(e){"enable"===r&&n.classList.contains("active")&&!n.querySelector(".uagb-modal-popup-wrap").contains(e.target)&&n.classList.remove("active"),i&&i.classList.contains("hide-scroll")&&UAGBModal.closeModalScrollCheck(i)})}},init(o,t,e){var{document_element:a,modalWrapper:l}=UAGBModal._getVariables(o),{modalTrigger:i,cssClass:c,cssID:s,exitIntent:n,showAfterSeconds:r,noOfSecondsToShow:d}=e="string"==typeof e?JSON.parse(e):e;if(l){var u=l.querySelector(".uagb-modal-trigger");UAGBModal._addTriggers(o,e);const m=l.querySelector(".uagb-modal-popup");switch(i){case"custom-class":c&&0<(p=a.querySelectorAll("."+c)).length&&p.forEach(function(e){UAGBModal.triggerAction(o,e,t,!0)});break;case"custom-id":t&&UAGBModal._show(o,m),s&&(p=a.querySelector("#"+s))&&UAGBModal.triggerAction(o,p,t,!0);break;case"automatic":var p=r?1e3*parseInt(d):1;UAGBModal._canShow(o,e)&&!n&&setTimeout(function(){UAGBModal._show(o,m),UAGBModal._afterOpen(o,e)},p),UAGBModal._exitIntent(o,m,n,e);break;default:UAGBModal.triggerAction(o,u,t,!1)}}},closeModalScrollCheck(e){0===document.querySelectorAll(".uagb-modal-popup.active").length&&e.classList.remove("hide-scroll")}};