joshua.seigler.net/main-Cn83fOYW.js
Joshua Seigler ea0b44ee35 Updates
2025-07-23 01:06:45 -04:00

1 line
3 KiB
JavaScript

(function(){const o=document.createElement("link").relList;if(o&&o.supports&&o.supports("modulepreload"))return;for(const e of document.querySelectorAll('link[rel="modulepreload"]'))i(e);new MutationObserver(e=>{for(const t of e)if(t.type==="childList")for(const s of t.addedNodes)s.tagName==="LINK"&&s.rel==="modulepreload"&&i(s)}).observe(document,{childList:!0,subtree:!0});function n(e){const t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin==="use-credentials"?t.credentials="include":e.crossOrigin==="anonymous"?t.credentials="omit":t.credentials="same-origin",t}function i(e){if(e.ep)return;e.ep=!0;const t=n(e);fetch(e.href,t)}})();function d(r){const{target:o}=r,n=document.querySelector("#effects");if(n==null)return;Array.from(n.children).filter(e=>e.__effectParent===o?!0:l(r)&&Array.from(r.changedTouches).some(t=>t.identifier===e.__effectTouch)).forEach(e=>{e.getAnimations().forEach(t=>{if(+(t.currentTime??0)<100){t.pause(),n.removeChild(e);return}t.pause(),t.updatePlaybackRate(-.25),t.play(),t.addEventListener("finish",()=>{n.contains(e)&&n.removeChild(e)})})})}function f(r){return r!==null&&typeof r.matches=="function"}function l(r){return r.type.startsWith("touch")}function a(r){const{target:o}=r,n=document.querySelector("#effects"),i=window.getComputedStyle(f(o)?o:document.body).getPropertyValue("--glowColor");let e=[];if(l(r))e=Array.from(r.targetTouches).map(t=>({top:t.clientY-5,left:t.clientX-5,width:10,height:10}));else{if(!f(o)||!o.matches("a[href],.nav-toggle-button,button,input[type='radio']"))return;e=Array.from(o.getClientRects()),Array.from(o.children).forEach(t=>{e.push(...Array.from(t.getClientRects()))})}e.forEach(t=>{var m;const{top:s,left:h,width:p,height:y}=t,c=document.createElement("div");l(r)?c.__effectTouch=(m=r.targetTouches.item(0))==null?void 0:m.identifier:c.__effectParent=o,c.classList.add("effect-instance");const u="10rem";c.style.top=`calc(${s+window.scrollY}px - ${u})`,c.style.left=`calc(${h+window.scrollX}px - ${u})`,c.style.width=`calc(${p}px + 2 * ${u})`,c.style.height=`calc(${y}px + 2 * ${u})`,c.style.setProperty("--glowColor",i),n==null||n.appendChild(c)})}function g(){document.querySelectorAll("pre[class^=language]").forEach(r=>{const o=document.createElement("button");o.classList.add("copy-button"),o.addEventListener("click",()=>{r instanceof HTMLElement&&navigator.clipboard.writeText(r.innerText)}),r.appendChild(o)})}function E({target:r}){!f(r)||!r.matches("a[href][target=_blank]")||umami==null||umami.track(`Link: ${r.innerText??r.getAttribute("href")}`,{from:document.location.href,destination:r.getAttribute("href")})}document.addEventListener("mouseenter",a,!0);document.addEventListener("focus",a,!0);document.addEventListener("touchstart",a,!0);document.addEventListener("mouseleave",d,!0);document.addEventListener("blur",d,!0);document.addEventListener("touchend",d,!0);document.addEventListener("touchcancel",d,!0);document.addEventListener("click",E,!0);document.addEventListener("DOMContentLoaded",g);