From cd5d1d8ce6c65c528963a2cd25d5fb5bbd889d66 Mon Sep 17 00:00:00 2001
From: Armando Liccardo
Date: Wed, 27 Nov 2024 15:27:33 +0000
Subject: [PATCH] adding minified js
---
scripts/linkPrefetch.min.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/scripts/linkPrefetch.min.js b/scripts/linkPrefetch.min.js
index a487957..e59fda1 100644
--- a/scripts/linkPrefetch.min.js
+++ b/scripts/linkPrefetch.min.js
@@ -1 +1 @@
-document.addEventListener("DOMContentLoaded",(()=>{const e=document.createElement("link"),t=e.relList?.supports?.("prefetch"),i=navigator.connection?.saveData||navigator.connection?.effectiveType?.includes("2g"),s="IntersectionObserver"in window&&"isIntersecting"in IntersectionObserverEntry.prototype;if(!t||i)return;const n=window.LP_CONFIG||{activeOnDesktop:!0,behavior:"mouseHover",hoverDelay:60,instantClick:!0,activeOnMobile:!0,mobileBehavior:"viewport",ignoreKeywords:"wp-admin,#,?"};new class{constructor(e){Object.assign(this,{activeOnDesktop:e.activeOnDesktop,behavior:e.behavior,hoverDelay:parseInt(e.hoverDelay)||60,ignoreKeywords:e.ignoreKeywords.split(","),instantClick:e.instantClick,mobileActive:e.activeOnMobile,isMobile:e.isMobile,mobileBehavior:e.mobileBehavior,prefetchedUrls:new Set,eventOptions:{capture:!0,passive:!0},timerId:null})}init(){const e=navigator.userAgent.includes("Chrome/"),t=e&&parseInt(navigator.userAgent.split("Chrome/")[1]);e&&t<110||this.isMobile&&!this.mobileActive||!this.isMobile&&!this.activeOnDesktop||(this.isMobile||("mouseHover"===this.behavior&&document.addEventListener("mouseover",this.handleHover.bind(this),this.eventOptions),"mouseDown"===this.behavior&&document.addEventListener("mousedown",this.instantClick?this.handleInstantClick.bind(this):this.handleMouseDown.bind(this),this.eventOptions)),this.isMobile&&"viewport"===this.mobileBehavior&&s&&this.setupViewportObserver())}setupViewportObserver(){const e=new IntersectionObserver((t=>{t.forEach((t=>{t.isIntersecting&&(e.unobserve(t.target),this.prefetchIfEligible(t.target.href))}))}));(window.requestIdleCallback||(e=>setTimeout(e,1)))((()=>setTimeout((()=>document.querySelectorAll("a").forEach((t=>e.observe(t)))),1e3)))}handleMouseDown(e){const t=e.target.closest("a");this.prefetchIfEligible(t?.href)}handleInstantClick(e){const t=e.target.closest("a");!t||e.which>1||e.metaKey||e.ctrlKey||(t.addEventListener("click",(e=>"instantClick"!==e.detail&&e.preventDefault()),{capture:!0,passive:!1,once:!0}),t.dispatchEvent(new MouseEvent("click",{bubbles:!0,cancelable:!1,detail:"instantClick"})))}handleHover(e){const t=e.target.closest("a");t&&this.prefetchIfEligible(t.href)&&(t.addEventListener("mouseout",(()=>clearTimeout(this.timerId)),this.eventOptions),this.timerId=setTimeout((()=>this.prefetchIt(t.href)),this.hoverDelay))}prefetchIfEligible(e){return!(!e||this.prefetchedUrls.has(e))&&(e.replace(/\/$/,"")!==location.href.replace(/\/$/,"")&&!this.ignoreKeywords.some((t=>e.includes(t))))}prefetchIt(e){const t=document.createElement("link");t.rel="prefetch",t.href=e,document.head.appendChild(t),this.prefetchedUrls.add(e)}}(n).init()}));
\ No newline at end of file
+document.addEventListener("DOMContentLoaded",(()=>{const e=document.createElement("link"),t=e.relList?.supports?.("prefetch"),i=navigator.connection?.saveData||navigator.connection?.effectiveType?.includes("2g"),s="IntersectionObserver"in window&&"isIntersecting"in IntersectionObserverEntry.prototype;if(!t||i)return;const n=window.LP_CONFIG||{activeOnDesktop:!0,behavior:"mouseHover",hoverDelay:60,instantClick:!0,activeOnMobile:!0,mobileBehavior:"viewport",ignoreKeywords:"wp-admin,#,?"};new class{constructor(e){Object.assign(this,{activeOnDesktop:e.activeOnDesktop,behavior:e.behavior,hoverDelay:parseInt(e.hoverDelay)||60,ignoreKeywords:e.ignoreKeywords.split(","),instantClick:e.instantClick,mobileActive:e.activeOnMobile,isMobile:e.isMobile,mobileBehavior:e.mobileBehavior,prefetchedUrls:new Set,eventOptions:{capture:!0,passive:!0},timerId:null})}init(){const e=navigator.userAgent.includes("Chrome/"),t=e&&parseInt(navigator.userAgent.split("Chrome/")[1]);e&&t<110||this.isMobile&&!this.mobileActive||!this.isMobile&&!this.activeOnDesktop||(this.isMobile||("mouseHover"===this.behavior&&document.addEventListener("mouseover",this.handleHover.bind(this),this.eventOptions),"mouseDown"===this.behavior&&document.addEventListener("mousedown",this.instantClick?this.handleInstantClick.bind(this):this.handleMouseDown.bind(this),this.eventOptions)),this.isMobile&&"viewport"===this.mobileBehavior&&s&&this.setupViewportObserver())}setupViewportObserver(){const e=new IntersectionObserver((t=>{t.forEach((t=>{t.isIntersecting&&(e.unobserve(t.target),this.prefetchIfEligible(t.target.href))}))}));(window.requestIdleCallback||(e=>setTimeout(e,1)))((()=>setTimeout((()=>document.querySelectorAll("a").forEach((t=>e.observe(t)))),1e3)))}handleMouseDown(e){const t=e.target.closest("a");this.prefetchIfEligible(t?.href)&&this.prefetchIt(t?.href)}handleInstantClick(e){const t=e.target.closest("a");!t||e.which>1||e.metaKey||e.ctrlKey||(t.addEventListener("click",(e=>"instantClick"!==e.detail&&e.preventDefault()),{capture:!0,passive:!1,once:!0}),t.dispatchEvent(new MouseEvent("click",{bubbles:!0,cancelable:!1,detail:"instantClick"})))}handleHover(e){const t=e.target.closest("a");t&&this.prefetchIfEligible(t.href)&&(t.addEventListener("mouseout",(()=>clearTimeout(this.timerId)),this.eventOptions),this.timerId=setTimeout((()=>this.prefetchIt(t.href)),this.hoverDelay))}prefetchIfEligible(e){return!(!e||this.prefetchedUrls.has(e))&&(e.replace(/\/$/,"")!==location.href.replace(/\/$/,"")&&!this.ignoreKeywords.some((t=>e.includes(t))))}prefetchIt(e){const t=document.createElement("link");t.rel="prefetch",t.href=e,document.head.appendChild(t),this.prefetchedUrls.add(e)}}(n).init()}));
\ No newline at end of file