Rust library to generate static websites
5
fork

Configure Feed

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

fix: adjust for feedback

+8 -7
+6 -5
crates/maudit/js/prefetch.ts
··· 31 31 } 32 32 33 33 function canPrefetchUrl(url: URL, skipConnectionCheck: boolean): boolean { 34 - if (!navigator.onLine) return false; 35 - if (!skipConnectionCheck && hasLimitedBandwidth()) return false; 36 - 37 34 return ( 38 - (window.location.origin === url.origin && window.location.pathname !== url.pathname) || 39 - (window.location.search !== url.search && !preloadedUrls.has(url.href)) 35 + navigator.onLine && // 1. Don't prefetch if the browser is offline (duh) 36 + (skipConnectionCheck || !hasLimitedBandwidth()) && // 2. Don't prefetch if the user has limited bandwidth, unless explicitely asked 37 + window.location.origin === url.origin && // 3. Don't prefetch cross-origin URLs 38 + !preloadedUrls.has(url.href) && // 4. Don't prefetch URLs we've already prefetched 39 + (window.location.pathname !== url.pathname || // 5. Don't prefetch the current page (different path or query string) 40 + window.location.search !== url.search) 40 41 ); 41 42 } 42 43
+2 -2
crates/maudit/js/prefetch/tap.ts
··· 20 20 21 21 document.addEventListener("DOMContentLoaded", attachListeners); 22 22 23 - function handleTap(e: Event) { 24 - const target = e.target as HTMLAnchorElement; 23 + function handleTap(e: TouchEvent | MouseEvent) { 24 + const target = e.currentTarget as HTMLAnchorElement; 25 25 26 26 if (!target.href) { 27 27 return;