* Update translation text domain * Escape everything that should be escaped. * Add nonce checks where needed. * Sanitize all inputs. * Apply Code style changes across the codebase. * Correct many deprecation notices. * Optimize load order of many filters. * Add Proper Build script * Use emojii flags * Fix i18n deprecation notice for translating too early * Put all scripts in footer and load async
2 lines
3.0 KiB
JavaScript
2 lines
3.0 KiB
JavaScript
(()=>{let t=(e,t,l)=>{let n;var o;n=l?((o=new Date).setTime(o.getTime()+24*l*60*60*1e3),"; expires="+o.toUTCString()):"",document.cookie=e+"="+t+n+"; path=/"},a=e=>{var l=e+"=",n=document.cookie.split(";");for(let t=0;t<n.length;t++){let e=n[t];for(;" "===e.charAt(0);)e=e.substring(1,e.length);if(0===e.indexOf(l))return e.substring(l.length,e.length)}return null};window.addEventListener("beforeunload",()=>{var e;return null==(e=window.top)?void 0:e.postMessage("wu_preview_changed","*")}),t("wu_template","");document.addEventListener("DOMContentLoaded",()=>{((t,l)=>{let n=a(t);setInterval(function(){var e=a(t);e!==n&&(n=e,l(n))},100)})("wu_selected_products",()=>document.location.reload());let n=document.getElementById("iframe");var e=null==n?void 0:n.contentWindow;null!=e&&e.postMessage("Hello to iframe from parent!","https://"+location.hostname);document.querySelectorAll("#action-select, #action-select2").forEach(e=>e.addEventListener("click",e=>{e.preventDefault();e=document.getElementById("template-selector").value;t("wu_template",e),window.close()})),null!=n&&n.addEventListener("load",()=>{var e;window.addEventListener("touchstart",()=>{}),e=(null==(e=null==navigator?void 0:navigator.userAgentData)?void 0:e.platform)||(null==navigator?void 0:navigator.platform)||"",["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(e)&&(null!=(e=null==(e=document.getElementById("iframe"))?void 0:e.getElementsByTagName("body")[0])&&e.classList.add("wu-fix-safari-preview"),null!=e)&&e.style&&Object.assign(e.style,{position:"fixed",top:0,right:0,bottom:0,left:0,"overflow-y":"scroll","-webkit-overflow-scrolling":"touch"})});var e=()=>{var e=(null==(e=document.getElementById("switcher"))?void 0:e.offsetHeight)||0;n.style.height=document.body.offsetHeight-e+"px"};window.addEventListener("resize",e),e();let o=()=>{document.querySelectorAll("#theme_list ul").forEach(e=>e.style.display="none"===e.style.display?"block":"none")};o(),null!=(e=document.getElementById("template_selector"))&&e.addEventListener("click",e=>{e.preventDefault(),o()}),document.querySelectorAll("#theme_list ul li a").forEach(e=>e.addEventListener("click",e=>{e.preventDefault(),o();var e=e.currentTarget,t=e.getAttribute("href")||"",l=(n.src=e.getAttribute("data-frame")||"",document.getElementById("template_selector"));l.firstChild.nodeValue=e.getAttribute("data-title")||"",window.history.pushState({},"",t)}));e=document.getElementById("header-bar");e&&(e.style.display="none");let l={desktop:"100%",tabletlandscape:"1040px",tabletportrait:"788px",mobilelandscape:"500px",mobileportrait:"340px",placebo:"0px"};document.querySelectorAll(".responsive a").forEach(e=>e.addEventListener("click",e=>{var e=e.currentTarget,t=Array.from(e.classList).reduce((e,t)=>e=l[t]?l[t]:e,"");n.style.width=t,n.style.transition="200ms",document.querySelectorAll(".responsive a").forEach(e=>e.classList.remove("active")),e.classList.add("active")})),null!==navigator.userAgent.match(/iPad/i)&&(n.style.height="100%")})})();
|