芝麻web文件管理V1.00
编辑当前文件:/home/r5772835/public_html/rigato.ycreate.site/wp-content/themes/swell/build/js/prefetch.min.js
!function(){console.log("[SWELL] on Prefetch");const e=!1;function o(){var o;const t=((null===(o=window.swellVars)||void 0===o?void 0:o.ignorePrefetchKeys)||"").split(",").reduce(((e,o)=>(""!==o.trim()&&e.push(o),e)),["/wp-admin/","/wp-admin/"]);return e&&console.log("除外キーワード一覧: "+t),t}!function(){if(!function(){const e=document.createElement("link");return!(!(e.relList&&e.relList.supports&&e.relList.supports("prefetch"))||!window.IntersectionObserver||!("isIntersecting"in IntersectionObserverEntry.prototype)||"undefined"==typeof Promise||navigator.connection&&(navigator.connection.saveData||(navigator.connection.effectiveType||"").includes("2g")))}())return;const t=new Set,n=new Set,r="ontouchstart"in window||navigator.maxTouchPoints>0||window.matchMedia("(pointer:coarse)").matches;e&&console.log("タッチデバイスかどうか: "+r);const s={delay:0,maxRPS:3,hoverDelay:50,observerDelay:500,ignoreKeywords:o(),...window.swllllPrefetchOptions},c=o=>{const t=setTimeout((()=>{f(),console.log("レスポンスが遅いため、プリロードを中断しました: "+o)}),5e3);(e=>new Promise(((o,t)=>{const n=document.createElement("link");n.rel="prefetch",n.href=e,n.onload=o,n.onerror=t,document.head.appendChild(n)})))(o).then((()=>{e&&console.log("prefetch link 追加完了: "+o)})).catch((e=>{console.error(e,o)})).finally((()=>clearTimeout(t)))},i=(o,r=!1)=>{if(n.has(o)||t.has(o))return;const i=window.location.origin;o.substring(0,i.length)===i&&window.location.href!==o&&(s.ignoreKeywords.some((e=>o.includes(e)))?e&&console.log("除外キーワード該当:",o):(e&&console.log("キューに追加: "+o),r?(c(o),n.add(o)):t.add(o)))},l=new IntersectionObserver((o=>{r&&o.forEach((o=>{if(o.isIntersecting){const t=o.target.href;setTimeout((()=>{e&&console.log("ビューポート内に入った: "+t),i(t,0===s.maxRPS)}),s.observerDelay)}}))}));let a=null;const u=o=>{const t=o.target.closest("a");null!=t&&t.href&&!n.has(t.href)&&(a=setTimeout((()=>{e&&console.log("マウスオーバーによるキューに追加開始: "+t.href),i(t.href,!0)}),s.hoverDelay))},d=o=>{const t=o.target.closest("a");null!=t&&t.href&&!n.has(t.href)&&(e&&console.log("タッチスタートによるキューに追加開始: "+t.href),i(t.href,!0))},h=o=>{const t=o.target.closest("a");null!=t&&t.href&&!n.has(t.href)&&(e&&console.log("マウスアウトによるプリロード中断: "+t.href),clearTimeout(a))},m=window.requestIdleCallback||function(e){const o=Date.now();return setTimeout((()=>{e({didTimeout:!1,timeRemaining(){return Math.max(0,50-(Date.now()-o))}})}),1)},f=()=>{document.querySelectorAll("a").forEach((e=>l.unobserve(e))),t.clear(),r?document.removeEventListener("touchstart",d,!0):(document.removeEventListener("mouseover",u,!0),document.removeEventListener("mouseout",h,!0))};setInterval((()=>{Array.from(t).slice(0,s.maxRPS).forEach((e=>{c(e),n.add(e),t.delete(e)}))}),1e3),m((()=>setTimeout((()=>document.querySelectorAll("a").forEach((e=>l.observe(e)))),1e3*s.delay)));const v={capture:!0,passive:!0};r?document.addEventListener("touchstart",d,v):(document.addEventListener("mouseover",u,v),document.addEventListener("mouseout",h,v))}()}();