-
Notifications
You must be signed in to change notification settings - Fork 0
/
enp-loader.min.js
8 lines (7 loc) · 21.2 KB
/
enp-loader.min.js
1
2
3
4
5
6
7
8
/*
ENPLATED FRAMEWORK v3.0 by Karel Cermak (info@karlosoft.com)
WEBSITE: https://enplated.karlosoft.com/framework/
DOCUMENTATION: https://enplated.karlosoft.com/framework/docs
LICENSE: https://enplated.karlosoft.com/framework/license
*/
var enplatedSettingsImport={bootstrapImportCss:"https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css",bootstrapDarkCss:"https://cdn.jsdelivr.net/gh/K-cermak/Enplated-Framework@enp-v3/enp-data/darkmode.min.css",bootstrapImportJs:"https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js",bootstrapIcons:"https://cdn.jsdelivr.net/npm/bootstrap-icons@1.10.4/font/bootstrap-icons.css",flashJs:"https://cdn.jsdelivr.net/gh/K-cermak/Enplated-Framework@enp-v3/enp-data/flash.min.js",flashCss:"https://cdn.jsdelivr.net/gh/K-cermak/Enplated-Framework@enp-v3/enp-data/flash.min.css",aosJs:"https://cdn.jsdelivr.net/npm/aos@2.3.4/dist/aos.min.js",aosCss:"https://cdn.jsdelivr.net/npm/aos@2.3.4/dist/aos.min.css",loaderDataset:"https://cdn.jsdelivr.net/gh/K-cermak/Enplated-Framework@enp-v3/enp-data/loaders.min.js",allowedLoaders:["sk-plane","sk-chase","sk-bounce","sk-wave","sk-pulse","sk-flow","sk-swing","sk-circle","sk-circlefade","sk-grid","sk-fold","sk-wander","vl-simplewheel","vl-onewheel","vl-doublewheel","vl-dotwheel","vl-mutliwheel","vl-lightwheel","vl-line"]};function startEnp(){bootstrapLoad(),window.addEventListener("load",(function(){varSetter(),dataSetter(),enplatedSettingsCustom.importFlash&&flashLoad(),enplatedSettingsCustom.importAOS&&aosLoad(),loaderLoad(),enplatedSettingsCustom.gdprAllowed&&enplatedSettingsCustom.gdprSettings.gdprSetters.currentVersion!=getCookieValue(enplatedSettingsCustom.gdprSettings.gdprSetters.mainCookieName)&&gdprLoad(),loadGoogleAnalytics(),loadCookieList()}))}function bootstrapLoad(){loadCss(enplatedSettingsImport.bootstrapImportCss),enplatedSettingsCustom.useDarkMode&&loadCss(enplatedSettingsImport.bootstrapDarkCss),includeJs(enplatedSettingsImport.bootstrapImportJs),loadCss(enplatedSettingsImport.bootstrapIcons)}function varSetter(){let e=document.querySelectorAll("[enpVar]");for(let t=0;t<e.length;t++){let n=e[t],o=n.getAttribute("enpVar"),s=enplatedSettingsCustom.smartVars[o];null!=s&&(n.innerHTML=s)}}function dataSetter(){let e=enplatedSettingsCustom.dataSetter;for(let t in e){let n=e[t],o=document.querySelectorAll(n.selector);for(let e=0;e<o.length;e++){let t=o[e];for(let e in n)"selector"!=e&&t.setAttribute(e,n[e])}}}function flashLoad(){includeJs(enplatedSettingsImport.flashJs),loadCss(enplatedSettingsImport.flashCss)}function aosLoad(){loadCss(enplatedSettingsImport.aosCss),includeJs(enplatedSettingsImport.aosJs).then((()=>{setTimeout((function(){AOS.init({once:!0})}),100)}))}function loaderLoad(){for(let e=0;e<enplatedSettingsImport.allowedLoaders.length;e++){let t=enplatedSettingsImport.allowedLoaders[e];if(document.querySelectorAll(t).length>0){includeJs(enplatedSettingsImport.loaderDataset).then((()=>{startAnimRender()}));break}}}function gdprLoad(){let e=window.location.hostname,t=window.location.pathname;if(!enplatedSettingsCustom.gdprSettings.disableOnDomains.includes(e)&&!enplatedSettingsCustom.gdprSettings.disableOnPath.includes(t)){let e=navigator.language||navigator.userLanguage;"undefined"!=typeof enpPageLang&&(e=enpPageLang),enplatedSettingsCustom.gdprSettings.allowedLang[e]||(e=enplatedSettingsCustom.gdprSettings.defaultLanguage);let t=document.createElement("div");t.classList.add("enp-gdpr-background"),t.style.position="fixed",t.style.top="0",t.style.left="0",t.style.width="100%",t.style.height="100%",t.style.backgroundColor="rgba(0,0,0,0.5)",t.style.zIndex="9999",document.body.style.overflow="hidden";let n=document.createElement("div");n.innerHTML+=genForm(e),t.appendChild(n),document.body.appendChild(t),gdprListeners(n)}}function gdprListeners(e){if(Object.keys(enplatedSettingsCustom.gdprSettings.allowedLang).length>1){document.querySelector(".gdprBox .gdprHeader .changeLanguage").addEventListener("click",(function(){document.querySelector(".gdprBox .mainContent").style.display="none",document.querySelector(".gdprBox .customizeSettings").style.display="none",document.querySelector(".gdprBox .languageSettings").style.display="flex",document.querySelector(".gdprBox .changeLanguage").style.display="none"}));let t=document.querySelectorAll(".langSwitcher");for(let n=0;n<t.length;n++)t[n].addEventListener("click",(function(){let o=t[n].getAttribute("lang");e.innerHTML=genForm(o),gdprListeners(e)}))}document.querySelector(".gdprBox .gdprOptions .settings").addEventListener("click",(function(){document.querySelector(".gdprBox .mainContent").style.display="none",document.querySelector(".gdprBox .customizeSettings").style.display="flex",document.querySelector(".gdprBox .languageSettings").style.display="none",document.querySelector(".gdprBox .changeLanguage").style.display="block"})),document.querySelector(".gdprBox .customizeSettings .goBack").addEventListener("click",(function(){document.querySelector(".gdprBox .mainContent").style.display="block",document.querySelector(".gdprBox .customizeSettings").style.display="none",document.querySelector(".gdprBox .languageSettings").style.display="none",document.querySelector(".gdprBox .changeLanguage").style.display="block"})),document.querySelector(".gdprBox .gdprOptions .agree").addEventListener("click",(function(){allowScroll(),cookieSetter("onAccept"),reloadCheck()})),document.querySelector(".gdprBox .customizeSettings .continueSelected").addEventListener("click",(function(){cookieSetter("custom"),allowScroll(),reloadCheck()})),document.querySelector(".gdprBox .gdprOptions .refuse").addEventListener("click",(function(){allowScroll(),cookieSetter("onDecline"),reloadCheck()}))}function genForm(e){let t='\n<style class="gdprStyles">\n.gdprBox, .gdprBox * {\npointer-events: auto;\n}\n.gdprBox h2, .gdprBox h4, .gdprBox h5, .gdprBox p {\ncolor: #000000;\nfont-family: inherit;\n}\n.gdprBox h2 {\nfont-size: 1.5em;\nmargin-top: 0.83em;\nmargin-bottom: 0.83em;\nmargin-left: 0;\nmargin-right: 0;\nfont-weight: bold;\n}\n.gdprBox h4 {\nmargin-top: 1.33em;\nmargin-bottom: 1.33em;\nmargin-left: 0;\nmargin-right: 0;\nfont-weight: bold;\n}\n.gdprBox h5 {\nfont-size: .83em;\nmargin-top: 1.67em;\nmargin-bottom: 1.67em;\nmargin-left: 0;\nmargin-right: 0;\nfont-weight: bold;\n}\n.gdprBox {\nbackground-color: #ffffff;\nwidth: 40%;\nposition: fixed;\ntop: 50%;\nleft: 50%;\nmargin-right: -50%;\ntransform: translate(-50%, -50%);\nborder-radius: 30px;\npadding: 20px 40px;\nfont-family: inherit;\nz-index: 9;\nmin-height: auto;\n}\n.gdprBox .customizeSettings, .gdprBox .languageSettings {\ndisplay: none;\n}\n/*HEADER*/\n.gdprBox .gdprHeader {\nmargin-top: 30px;\ndisplay: flex;\nflex-direction: row;\njustify-content: space-between;\nalign-items: center;\n}\n.gdprBox .gdprHeader h2 {\ncolor: #000000;\n}\n.gdprBox .gdprHeader img {\ntransition: 0.2s;\ncursor: pointer;\n}\n.gdprBox .gdprHeader img:hover {\nfilter: brightness(0.8);\n}\n\n/*MAIN AREA*/\n.gdprBox .mainContent .message p {\nmargin: 35px 0; \ncolor: #000000;\n}\n.gdprBox .mainContent .message a {\ncolor: #03a9f4;\ntransition: 0.2s;\ntext-decoration: none;\n}\n.gdprBox .mainContent .message a:hover {\ncolor: #0072a6;\n}\n\n/*OPTIONS UNDER MAIN AREA + BUTTONS + LINKS*/\n.gdprBox .gdprOptions {\ndisplay: flex;\njustify-content: space-between;\n}\n.gdprBox .gdprOptions button.agree, .gdprBox .customizeSettings button.continueSelected {\npadding: 10px 20px;\nmargin: 10px 0 10px 0;\nfont-family: inherit;\nfont-size: 1.1em;\nborder: none;\nbackground-color: #03a9f4;\ncolor: #ffffff;\ntransition: 0.2s;\nborder-radius: 18px;\n}\n.gdprBox .gdprOptions button.agree:hover, .gdprBox .customizeSettings button.continueSelected:hover {\nbackground-color: #0072a6;\ncursor: pointer;\n}\n.gdprBox .gdprOptions .moreOptions {\ndisplay: flex;\nflex-direction: column;\njustify-content: center;\nalign-items: flex-end;\ntext-align: right;\npadding: 0 0 0 10px;\n}\n.gdprBox .gdprOptions .moreOptions h4 {\nmargin: 0 0 5px 0;\nfont-weight: 500;\ntransition: 0.3s;\nfont-size: 0.9em;\n}\n.gdprBox .gdprOptions .moreOptions h4:hover, .gdprBox .customizeSettings .goBack:hover {\ncursor: pointer;\ntext-decoration: underline;\ntext-underline-offset: 2px;\ntext-decoration-color: #222222;\n}\n\n/*CUSTOMIZE OPTIONS*/\n.gdprBox .customizeSettings {\nflex-direction: column;\n}\n.gdprBox .customizeSettings .goBack {\ntransition: 0.3s;\nmargin: -10px 0 30px 0;\n}\n.gdprBox .customizeSettings .settingsBlock {\noverflow-y: scroll;\nheight: 300px;\npadding: 0 20px 0 0;\n}\n.gdprBox .settingsOption {\ndisplay: flex;\nflex-direction: row;\njustify-content: space-between;\nalign-items: center;\n}\n.gdprBox .settingsBlock details {\nmargin: 0 0 10px 0;\n}\n.gdprBox .settingsBlock summary {\ndisplay: flex;\nflex-direction: row;\njustify-content: space-between;\n}\n.gdprBox .settingsBlock summary:hover {\ncursor: pointer;\n}\n.gdprBox .settingsBlock details summary h4:nth-of-type(1)::before {\ncontent: "► ";\n}\n.gdprBox .settingsBlock details[open] summary h4:nth-of-type(1)::before {\ncontent: "▼ ";\n}\n.gdprBox .settingsBlock details summary h4:nth-of-type(2) {\ntext-align: right;\n}\n.gdprBox .settingsBlock details[open] summary ~ * {\nanimation: sweep 0.3s ease-in-out;\n}\n.gdprBox .settingsOption .settingsOption h5 {\nwidth: 80%;\n}\n\n/*LANGUAGE SETTINGS*/\n.gdprBox .languageSettings {\nflex-direction: row;\njustify-content: space-around;\nalign-items: center;\npadding: 50px;\n}\n.gdprBox .languageSettings img {\ntransition: 0.3s;\nmargin: 0 10px;\n}\n.gdprBox .languageSettings img:hover {\ncursor: pointer;\nfilter: brightness(60%);\n}\n\n/*SWITCHES*/\n.gdprBox .switchInput {\nmargin: 5px 0 0 20px;\nposition: relative;\ndisplay: inline-block;\nwidth: 48px;\nheight: 20px;\n}\n.gdprBox .switchInput input { \nopacity: 0;\nwidth: 0;\nheight: 0;\n}\n.gdprBox .sliderInput {\nposition: absolute;\ncursor: pointer;\ntop: 0;\nleft: 0;\nright: 0;\nbottom: 0;\nbackground-color: #ccc;\n-webkit-transition: 0.3s;\ntransition: 0.3s;\nborder-radius: 17px;\n}\n.gdprBox .sliderInput:before {\nposition: absolute;\ncontent: "";\nheight: 13px;\nwidth: 13px;\nleft: 4px;\nbottom: 3.5px;\nbackground-color: #ffffff;\n-webkit-transition: 0.3s;\ntransition: 0.3;\nborder-radius: 50%;\n}\n.gdprBox input:checked + .sliderInput {\nbackground-color: #005ca7;\n}\n.gdprBox input:focus + .sliderInput {\nbox-shadow: 0 0 1px #005ca7;\n}\n.gdprBox input:checked + .sliderInput.disabled {\nbackground-color: #333333;\n}\n.gdprBox input:focus + .sliderInput.disabled {\nbox-shadow: 0 0 1px #333333;\n}\n.gdprBox input:checked + .sliderInput:before {\n-webkit-transform: translateX(26px);\n-ms-transform: translateX(26px);\ntransform: translateX(26px);\n}\n.gdprBox .settingsBlock .name::before {\ncontent: "▶ ";\n}\n.gdprBox .settingsBlock details[open] .name::before {\ncontent: "🔽 ";\n}\n/*MEDIA*/\n@media (max-width: 1024px) {\n.gdprBox {\nwidth: 60%;\n}\n.gdprBox .gdprOptions {\nflex-direction: column-reverse;\n}\n.gdprBox .gdprOptions .moreOptions {\ntext-align: center;\nalign-items: center;\nmargin-bottom: 20px;\n}\n.gdprBox .gdprOptions h4 {\nfont-size: 1em;\n}\n}\n@media (max-width: 768px) {\n.gdprBox {\nwidth: 90%;\n}\n}\n/*ANIMATIONS*/\n@keyframes sweep {\n0%{\nopacity: 0;\nmargin-left: -5px;\n}\n100% {\nopacity: 1;\nmargin-left: 0;\n}\n}\n</style>\n';t+='\n<div class="gdprBox">\n<div class="gdprHeader">\n<h2>'+enplatedSettingsCustom.gdprSettings.allowedLang[e].texts.title+"</h2>",Object.keys(enplatedSettingsCustom.gdprSettings.allowedLang).length>1&&(t+='<h4 class="changeLanguage"><img src="'+enplatedSettingsCustom.gdprSettings.allowedLang[e].flag+'" alt="Change Language Button" height="40px"></h4>'),t+='</div>\n<div class="mainContent">\n<div class="message">\n<p>'+enplatedSettingsCustom.gdprSettings.allowedLang[e].texts.mainScreen.info+'</p>\n</div>\n<div class="gdprOptions">\n<button class="agree">'+enplatedSettingsCustom.gdprSettings.allowedLang[e].texts.buttons.acceptButton+'</button>\n<div class="moreOptions">\n<h4 class="settings">'+enplatedSettingsCustom.gdprSettings.allowedLang[e].texts.buttons.customizeButton+'</h4>\n<h4 class="refuse">'+enplatedSettingsCustom.gdprSettings.allowedLang[e].texts.buttons.declineButton+'</h4>\n</div>\n</div>\n</div>\n<div class="customizeSettings">\n<p class="goBack">'+enplatedSettingsCustom.gdprSettings.allowedLang[e].texts.buttons.goBack+'</p>\n<div class="settingsBlock">';for(let n in enplatedSettingsCustom.gdprSettings.gdprSetters.individualCookies)t+='<details class="'+n+'">\n<summary><h5 class="name">'+enplatedSettingsCustom.gdprSettings.allowedLang[e].texts.cookies[n].name+'</h5><h5 class="function">'+enplatedSettingsCustom.gdprSettings.allowedLang[e].texts.cookies[n].type+'</h5></summary>\n<div class="settingsOption">\n<p>'+enplatedSettingsCustom.gdprSettings.allowedLang[e].texts.cookies[n].description+"</p>\n<div class='inputElement'>\n<label class='switchInput'>",enplatedSettingsCustom.gdprSettings.gdprSetters.individualCookies[n].canBeChanged?(enplatedSettingsCustom.gdprSettings.gdprSetters.individualCookies[n].default?t+="<input type='hidden' class='"+n+"Input' name='"+n+"Input' value='0'>\n<input type='checkbox' class='"+n+"Input' name='"+n+"Input' value='1' checked>":t+="<input type='hidden' class='"+n+"Input' name='"+n+"Input' value='0' checked>\n<input type='checkbox' class='"+n+"Input' name='"+n+"Input' value='1'>",t+="<span class='sliderInput'></span>"):(enplatedSettingsCustom.gdprSettings.gdprSetters.individualCookies[n].default?t+="<input type='hidden' class='"+n+"Input' name='"+n+"Input' value='0' onclick=\"return false;\">\n<input type='checkbox' class='"+n+"Input' name='"+n+"Input' value='1' checked onclick=\"return false;\">":t+="<input type='hidden' class='"+n+"Input' name='"+n+"Input' value='0' checked onclick=\"return false;\">\n<input type='checkbox' class='"+n+"Input' name='"+n+"Input' value='1' onclick=\"return false;\">",t+="<span class='sliderInput disabled'></span>"),t+="</label>\n</div>\n</div>\n</details>";t+='</div>\n<button class="continueSelected">'+enplatedSettingsCustom.gdprSettings.allowedLang[e].texts.buttons.continueWithSelected+'</button>\n</div>\n<div class="languageSettings">';for(let e in enplatedSettingsCustom.gdprSettings.allowedLang)t+='<img src="'+enplatedSettingsCustom.gdprSettings.allowedLang[e].flag+'" height="40px" alt="'+enplatedSettingsCustom.gdprSettings.allowedLang[e].codename+'" class="langSwitcher" lang='+e+">";return t+="</div></div>",t}function setCookie(e,t,n,o,s){let i=e+"="+encodeURIComponent(t)+";";if(n&&(i+="path="+n+";"),o&&(i+="domain="+o+";"),s){let e=new Date;e.setTime(e.getTime()+24*s*60*60*1e3),i+="expires="+e.toGMTString()+";"}document.cookie=i}function cookieSetter(e){let t=enplatedSettingsCustom.gdprSettings.gdprSetters.mainCookieName,n=enplatedSettingsCustom.gdprSettings.gdprSetters.currentVersion,o=enplatedSettingsCustom.gdprSettings.gdprSetters.path,s=enplatedSettingsCustom.gdprSettings.gdprSetters.domain,i=enplatedSettingsCustom.gdprSettings.gdprSetters.expireInDays;setCookie(t,n,o,s,i);for(let t in enplatedSettingsCustom.gdprSettings.gdprSetters.individualCookies){let n=enplatedSettingsCustom.gdprSettings.gdprSetters.individualCookies[t].cookieName,a="";a="custom"==e?!!document.querySelectorAll("."+t+"Input")[1].checked:enplatedSettingsCustom.gdprSettings.gdprSetters.individualCookies[t][e],setCookie(n,a,o,s,i)}}function allowScroll(){document.body.style.overflow="auto",document.querySelector(".enp-gdpr-background").remove()}function reloadCheck(){enplatedSettingsCustom.gdprSettings.reloadAfterComplete&&window.location.reload()}function getCookieValue(e){let t=document.cookie.match("(^|;)\\s*"+e+"\\s*=\\s*([^;]+)");return t?t.pop():""}function loadGoogleAnalytics(){if(1==enplatedSettingsCustom.gdprSettings.googleAnalytics.enable&&"true"==getCookieValue(enplatedSettingsCustom.gdprSettings.googleAnalytics.cookieName)){let t=enplatedSettingsCustom.gdprSettings.googleAnalytics.anonymizeIp,n=enplatedSettingsCustom.gdprSettings.googleAnalytics.trackingId,o=document.createElement("script");function e(){dataLayer.push(arguments)}o.src="https://www.googletagmanager.com/gtag/js?id="+n,o.async=!0,document.head.appendChild(o),window.dataLayer=window.dataLayer||[],e("js",new Date),e("config",n,{anonymize_ip:t})}}function loadCookieList(){if(document.querySelector("enp-gdpr")){let e=document.querySelector("enp-gdpr"),t=e.getAttribute("lang"),n='<div class="cookieList">';n+='<div class="cookieItem">\n<h4>'+enplatedSettingsCustom.gdprSettings.allowedLang[t].texts.gdprTitles.cookieListTitle+':</h4>\n<p class="mt-1 mb-5"><strong>'+enplatedSettingsCustom.gdprSettings.allowedLang[t].texts.gdprTitles.consentVersion+":</strong> "+getCookieValue(enplatedSettingsCustom.gdprSettings.gdprSetters.mainCookieName).toString()+"</p>\n</div>";for(let e in enplatedSettingsCustom.gdprSettings.gdprSetters.individualCookies)n+='<div class="cookieItem">\n<h4>'+enplatedSettingsCustom.gdprSettings.allowedLang[t].texts.cookies[e].name+" - "+enplatedSettingsCustom.gdprSettings.allowedLang[t].texts.cookies[e].type+'</h4>\n<p class="m-0">'+enplatedSettingsCustom.gdprSettings.allowedLang[t].texts.cookies[e].description+'</p>\n<h5 class="mt-1 mb-5">'+enplatedSettingsCustom.gdprSettings.allowedLang[t].texts.gdprTitles.cookieValue+": "+getCookieValue(enplatedSettingsCustom.gdprSettings.gdprSetters.individualCookies[e].cookieName).toString()+"</h5>\n</div>";n+='<div class="cookieItem">\n<button class="btn btn-danger" id="enpGdprReset">'+enplatedSettingsCustom.gdprSettings.allowedLang[t].texts.gdprTitles.resetConset+"</button>\n</div>",n+="</div>",e.innerHTML=n,document.querySelector("#enpGdprReset").addEventListener("click",(function(){resetConsent()}))}}function resetConsent(){let e=document.cookie.split("; ");for(let t=0;t<e.length;t++){let n=window.location.hostname.split(".");for(;n.length>0;){let o=encodeURIComponent(e[t].split(";")[0].split("=")[0])+"=; expires=Thu, 01-Jan-1970 00:00:01 GMT; domain="+n.join(".")+" ;path=",s=location.pathname.split("/");for(document.cookie=o+"/";s.length>0;)document.cookie=o+s.join("/"),s.pop();n.shift()}}document.location.reload(!0)}async function includeJs(e){await new Promise((t=>{let n=document.createElement("script");n.onload=()=>{t()},n.src=e,document.head.appendChild(n)}))}function loadCss(e){document.querySelector("head").insertAdjacentHTML("beforeend","<link rel='stylesheet' href='"+e+"' />")}function genFlashMessage(e,t,n){let o={progress:!0,interactive:!0,timeout:n,container:".flash-container"};"success"==t?window.FlashMessage.success(e,o):"error"==t?window.FlashMessage.error(e,o):"warning"==t?window.FlashMessage.warning(e,o):"info"==t&&window.FlashMessage.info(e,o)}function genRandomId(){let e="",t="abcdefghijklmnopqrstuvwxyz";for(let n=0;n<10;n++)e+=t.charAt(Math.floor(26*Math.random()));return e}function startAnimRender(){for(let e=0;e<enplatedSettingsImport.allowedLoaders.length;e++){let t=enplatedSettingsImport.allowedLoaders[e];for(let e=0;e<document.querySelectorAll(t).length;e++){let n,o,s=t.split("-")[0],i=t.split("-")[1],a=document.querySelectorAll(t)[e],l=a.getAttribute("color"),r=genRandomId();if("sk"==s)n=loadersData.spinkit[i].html,o=loadersData.spinkit[i].css,n=n.replaceAll("selector",r),o=o.replaceAll("selector",r),l&&(o=o.replaceAll("#333",l));else if("vl"==s){n="<span class='selector'></span>",o=loadersData.vinloaders[i].css;let e=a.getAttribute("color2"),t=a.getAttribute("color3");l&&(o=o.replaceAll("#ff3d00",l)),e&&(o=o.replaceAll("#fff",e)),t&&(o=o.replaceAll("#eee",t))}n=n.replaceAll("selector",r),o=o.replaceAll("selector",r),a.innerHTML=n,a.insertAdjacentHTML("beforeend","<style>"+o+"</style>")}}}startEnp();var modalLinks=[];function genModal(e){let t=genRandomId(),n='<div class="modal fade" id="'+t+'" tabindex="-1" role="dialog" aria-labelledby="'+t+'Label" aria-hidden="true"';e.global.closable||(n+='data-bs-backdrop="static" data-bs-keyboard="false"'),n+='><div class="modal-dialog modal-'+e.global.size,e.global.scrollable&&(n+=" modal-dialog-scrollable"),"center"==e.global.position&&(n+=" modal-dialog-centered"),n+='" role="document">\n<div class="modal-content">\n<div class="modal-header">\n<h5 class="modal-title">'+e.header.title+"</h5>",e.header.closeButton&&(n+='<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>'),n+='</div><div class="modal-body">'+e.main.content+'</div><div class="modal-footer">';for(let t=0;t<Object.keys(e.footer.buttons).length;t++){let o=e.footer.buttons[Object.keys(e.footer.buttons)[t]];n+='<button type="button" class="btn btn-'+o.type+'">'+o.text+"</button>"}n+="</div></div></div></div>",document.querySelector("body").insertAdjacentHTML("beforeend",n);for(let n=0;n<Object.keys(e.footer.buttons).length;n++){let o=e.footer.buttons[Object.keys(e.footer.buttons)[n]];document.querySelectorAll("#"+t+" .modal-footer button")[n].addEventListener("click",(function(){if("close"==o.function)closeModal(t);else if("reload"==o.function)location.reload();else if("submit"==o.function){if(o.dataset){let e=o.dataset.toString().replaceAll("selector","#"+t);if(e=new Function("return "+e)(),0==e())return}document.querySelector("#"+t+" form").submit()}else if("redirect"==o.function)window.location.href=o.dataset;else if("function"==o.function){let e=o.dataset.toString().replaceAll("selector",t);e=new Function("return "+e)(),e()}}))}return showModal(t),t}function showModal(e){let t=new bootstrap.Modal(document.querySelector("#"+e),{});t.show();let n={id:e,modal:t};modalLinks.push(n)}function closeModal(e){for(let t=0;t<modalLinks.length;t++)modalLinks[t].id==e&&modalLinks[t].modal.hide()}