-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathapp-built.js
1 lines (1 loc) · 4.21 KB
/
app-built.js
1
"use strict";(()=>{var D,o=(D=globalThis.window)!==null&&D!==void 0?D:globalThis,b=!1,y=!1,k=!0,x=o?.scrollY,w=o?.scrollX,z=x,P=w,E=null,_=null,s={x:[],y:[]};function $(){let e=!1;s.x.length&&(w=o.scrollX),s.y.length&&(x=o.scrollY);let i={scrollX:w,scrollY:x},l=new Set;x!==z&&(s.y.forEach(n=>{n(i),l.add(n)}),z=x,e=!0),w!==P&&(s.x.forEach(n=>{l.has(n)||n(i)}),P=w,e=!0),e&&E!=null&&(clearTimeout(E),E=null),y=!1,q()}function Q(){if(!(b||y)){if(P=w=o?.scrollX,z=x=o?.scrollY,k){b=!0,o.addEventListener("scroll",Y),document.body.addEventListener("touchmove",Y);return}q()}}function W(){b&&(o.removeEventListener("scroll",Y),document.body.removeEventListener("touchmove",Y),b=!1)}function Y(){k=!1,q(),W()}function q(){y||(E==null&&(E=setTimeout(ee,1500)),_=o.requestAnimationFrame($),y=!0)}function j(){y&&(_!=null&&(o.cancelAnimationFrame(_),_=null),y=!1)}function ee(){k=!0,j(),Q()}function S(e,i={}){Q();let{x:l,y:n,horizontal:d=l,vertical:u=n}=i;return!d&&!u&&(u=!0),d&&(s.x=s.x.concat(e)),u&&(s.y=s.y.concat(e)),()=>{if(d){let T=s.x.indexOf(e);T>-1&&s.x.splice(T,1)}if(u){let T=s.y.indexOf(e);T>-1&&s.y.splice(T,1)}!s.x.length&&!s.y.length&&(j(),W())}}var M,L=(M=globalThis.window)!==null&&M!==void 0?M:globalThis,g=null,a=null,A=0,f=!1,p=!1,v=null,O="fixed",m=null,c=null,t=null,r={},H={};function G(){t&&(f=!0,p=!1,m&&t.classList.add(m),c&&t.classList.remove(c),t.style.position=O,t.style.top="0px",r.top=0)}function te(){if(!t||!f||r.height==null||a==null||g==null)return;A=0,f=!1,m&&t.classList.remove(m),c&&t.classList.remove(c);let e=null;p?p=!1:a>g+r.height+5?e=g+5:e=a,e!=null&&(t.style.top=e+"px",r.top=e),t.style.position="absolute"}function ie(){return!f&&r.top>a?(G(),!0):!1}function le({scrollY:e}){if(a=e,t==null||H.clientHeight==null||H.scrollHeight==null||r.height==null||r.top==null||g==null||a<0)return;let i=a-g;g=a,!ie()&&(i<0?!f&&i>r.height||p&&a<=r.top+2?G():!f&&!p&&(A>6&&(f=!0,r.height=t.offsetHeight,a>r.top+r.height+25&&(r.top=a-r.height-25,t.style.top=r.top+"px",c&&t.classList.add(c)),p=!0),A++):f&&te())}function J(){v=null,a=g=L.scrollY,H.clientHeight=document.documentElement.clientHeight,H.scrollHeight=document.documentElement.scrollHeight,r.height=t?.offsetHeight}function U(){v!=null&&L.clearTimeout(v),v=L.setTimeout(J,150)}function K(e,i={}){t=e,O=i.useSticky?"sticky":"fixed",i.classNameAffixed&&(m=i.classNameAffixed),i.classNameAffixing&&(c=i.classNameAffixing);let l=t.style.position,n=t.style.top;t.style.position="absolute",t.style.top="0px",r.top=0,J(),L.addEventListener("resize",U);let d=S(le,{vertical:!0});return()=>{d(),L.removeEventListener("resize",U),t&&(t.style.position=l,t.style.top=n,m&&t.classList.remove(m),c&&t.classList.remove(c),t=null),O="fixed",m=c=null,r=H={},p=f=!1,a=g=null,A=0,v!=null&&(L.clearTimeout(v),v=null)}}function X(e){var i=window.location.hostname.replace("www.",""),l="mai",n="and",d,u;for(l+="lto:"+n,l+="rew@"+i,n+="rew",n+="@"+i,l+="?subject="+encodeURI(document.title),d=function(){this.href=l},u=0;u<e.length;++u)e[u].addEventListener("click",d),e[u].innerHTML=n}function ne(){var e=this.parentElement.previousElementSibling,i="is-toggled",l="data-text"+(e.classList.contains(i)?"":"-toggled"),n;e!==null&&(e.classList.toggle(i),n=this.getAttribute(l),n&&n.length&&(this.innerHTML=n))}function F(){var e=document.querySelectorAll(".image-comparison-toggle"),i,l;for(l=0;l<e.length;l++)i=previousElementSibling(e[l].parentElement),i!==null&&(i.classList.add("image-comparison-wrap"),e[l].setAttribute("data-text",e[l].innerHTML),e[l].addEventListener("click",ne))}var h=null,C=null;var B,I,V,Z;function N(e){if(I=e?e.scrollY:window.scrollY,C===null){if(h===null||!h.naturalWidth){window.setTimeout(N,150);return}C=h.parentElement,h.src.substring(h.src.length-4)===".svg"&&C.classList.add("is-svg"),V=I,B&&B(),B=S(N)}var i=C.clientHeight,l=I/i;if(!(l>1)){var n=(h.clientHeight-i)/2;n<=10||(V=I,h.style.transform="translateY("+Math.min(Math.round(n*l*-1),n)+"px)")}}function oe(){Z&&window.clearTimeout(Z),window.setTimeout(N,150)}function R(e){e&&(h=e,N(window.pageYOffset),window.addEventListener("resize",oe))}addEventListener("DOMContentLoaded",function(){X(document.querySelectorAll(".get-in-touch-link")),F(),R(document.querySelector(".post__splash > img")),K(document.querySelector(".header-menubar"))});})();