PageSourceSearch

https://www.photogrid.app/_nuxt/DxxWfSPw.js

js photogrid.app collected 2026-10-02 04:58:06 UTC 3,748 bytes, 1 lines download raw bytes

1let w=!1,S=!1,a=null,c=null,s=null,d=null,f=null;function L(){try{const n=performance.getEntriesByName("first-contentful-paint");if(n.length>0)return Math.round(n[0].startTime)}catch(n){console.warn("获取 FCP 失败:",n)}return 0}function C(n){if("PerformanceObserver"in window)try{c=new PerformanceObserver(e=>{const r=e.getEntries(),t=r[r.length-1];t&&t.renderTime&&(n(Math.round(t.renderTime)),c?.disconnect(),c=null)}),c.observe({entryTypes:["largest-contentful-paint"]})}catch(e){console.warn("初始化 LCP Observer 失败:",e)}}function O(n){if("PerformanceObserver"in window)try{s=new PerformanceObserver(e=>{const r=e.getEntries();for(const t of r){const l=t;if(l.processingStart&&l.startTime){const o=Math.round(l.processingStart-l.startTime);n(o),s?.disconnect(),s=null;break}}}),s.observe({entryTypes:["first-input"]})}catch(e){console.warn("初始化 FID Observer 失败:",e)}}function P(n){if(!("PerformanceObserver"in window))return;let e=0;const r=[];try{d=new PerformanceObserver(t=>{for(const l of t.getEntries()){const o=l;o.hadRecentInput||(r.push(o),e+=o.value)}}),d.observe({entryTypes:["layout-shift"]}),f&&window.removeEventListener("beforeunload",f),f=()=>{n(Math.round(e*1e3)/1e3)},window.addEventListener("beforeunload",f,{once:!0})}catch(t){console.warn("初始化 CLS Observer 失败:",t)}}function M(n){const e={title:"padding:4px 10px;background:#00DC82;color:white;font-weight:bold;",label:"padding:2px 6px;background:#333;color:#00DC82;font-weight:bold;",value:"padding:2px 6px;background:#f0f0f0;color:#333;"};console.group("性能指标",e.title),n.loadTime&&console.log(`%c页面加载时间: %c${n.loadTime}ms`,e.label,e.value),n.domContentLoaded&&console.log(`%cDOM 加载时间: %c${n.domContentLoaded}ms`,e.label,e.value),n.ttfb&&console.log(`%c首字节时间 (TTFB): %c${n.ttfb}ms`,e.label,e.value),n.dnsTime&&console.log(`%cDNS 查询时间: %c${n.dnsTime}ms`,e.label,e.value),n.tcpTime&&console.log(`%cTCP 连接时间: %c${n.tcpTime}ms`,e.label,e.value),n.requestTime&&console.log(`%c请求响应时间: %c${n.requestTime}ms`,e.label,e.value),n.fcp&&console.log(`%c首次内容绘制 (FCP): %c${n.fcp}ms`,e.label,e.value),n.lcp&&console.log(`%c最大内容绘制 (LCP): %c${n.lcp}ms`,e.label,e.value),n.fid&&console.log(`%c首次输入延迟 (FID): %c${n.fid}ms`,e.label,e.value),n.cls!==void 0&&console.log(`%c累积布局偏移 (CLS): %c${n.cls}`,e.label,e.value),console.groupEnd()}function $(){return{measurePageLoad:()=>{if(!("performance"in window)||S)return;const r=performance.getEntriesByType("navigation")[0];if(r&&r.type!=="navigate"&&r.type!=="reload")return;const t={};C(o=>{t.lcp=o}),O(o=>{t.fid=o}),P(o=>{t.cls=o});const l=()=>{a&&clearTimeout(a),a=setTimeout(()=>{a=null;const o=performance.getEntriesByType("navigation")[0];if(!o)return;const i=o.fetchStart||0,u=o.loadEventEnd||0;if(i<=0||u<=0)return;t.loadTime=Math.round(u-i);const p=o.domContentLoadedEventEnd||0;p>0&&(t.domContentLoaded=Math.round(p-i));const m=o.responseStart||0;m>0&&(t.ttfb=Math.round(m-i));const v=o.domainLookupStart||0,b=o.domainLookupEnd||0;v>0&&b>0&&(t.dnsTime=Math.round(b-v));const g=o.connectStart||0,T=o.connectEnd||0;g>0&&T>0&&(t.tcpTime=Math.round(T-g));const y=o.requestStart||0,h=o.responseEnd||0;y>0&&h>0&&(t.requestTime=Math.round(h-y));const E=L();E>0&&(t.fcp=E),t.loadTime>0&&t.loadTime<3e5?(S=!0,M(t)):console.warn("性能数据异常:",{loadEventEnd:u,fetchStart:i,loadTime:t.loadTime,navigationType:o.type,readyState:document.readyState})},100)};if(document.readyState==="complete"){l();return}w||(w=!0,window.addEventListener("load",l,{once:!0}))},cleanup:()=>{a&&(clearTimeout(a),a=null),c&&(c.disconnect(),c=null),s&&(s.disconnect(),s=null),d&&(d.disconnect(),d=null)}}}export{$ as u};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.