Rust library to generate static websites
5
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix: im stupid

+5 -4
+5 -4
crates/maudit/js/prefetch/tap.ts
··· 6 6 const observeMutations = true; 7 7 8 8 function init() { 9 - // Attach click listeners to all anchors 9 + // Attach touchstart/mousedown listeners to all anchors 10 10 const attachListeners = () => { 11 11 const anchors = document.getElementsByTagName("a"); 12 12 for (const anchor of anchors) { 13 13 if (listenedAnchors.has(anchor)) continue; 14 14 15 15 listenedAnchors.add(anchor); 16 - anchor.addEventListener("click", handleClick, { passive: true }); 16 + anchor.addEventListener("touchstart", handleTap, { passive: true }); 17 + anchor.addEventListener("mousedown", handleTap, { passive: true }); 17 18 } 18 19 }; 19 20 20 21 document.addEventListener("DOMContentLoaded", attachListeners); 21 22 22 - function handleClick(e: Event) { 23 + function handleTap(e: Event) { 23 24 const target = e.target as HTMLAnchorElement; 24 25 25 26 if (!target.href) { 26 27 return; 27 28 } 28 29 29 - // Prefetch on click 30 + // Prefetch on tap/mousedown 30 31 prefetch(target.href); 31 32 } 32 33