PageSourceSearch

https://www.ispringsolutions.com/dist/js-min/utils/lazyLoadSources.js?17906827792627

js ispringsolutions.com collected 2026-10-01 08:30:02 UTC 2,627 bytes, 1 lines download raw bytes

1let documentSources=new Map;document.addEventListener("DOMContentLoaded",()=>{let e=e=>e.split("?")[0].replace(window.location.origin,"");document.querySelectorAll('link[rel="stylesheet"]').forEach(t=>documentSources.set(e(t.href),{element:t})),document.querySelectorAll("script[src]").forEach(t=>documentSources.set(e(t.src),{element:t}))});let lazyLoadSources=e=>{let{selector:t,styles:o=[],scripts:n=[],callback:r,lazyload:s=!0}=e,l=document.querySelectorAll(t);if("IntersectionObserver"in window&&s){let e=new IntersectionObserver((e,t)=>{e.forEach(async e=>{e.isIntersecting&&Promise.all([loadSources(n,loadScript),loadSources(o,loadStyle)]).then(()=>r&&r(e.target)).catch(e=>{console.error(e)}).finally(()=>t.unobserve(e.target))})},{rootMargin:"200px 0px",threshold:0});l.forEach(t=>e.observe(t))}else l.forEach(async e=>{Promise.all([loadSources(n,loadScript),loadSources(o,loadStyle)]).then(()=>r&&r(e.target)).catch(e=>{console.error(e)})})};function waitLoadEnd(e){return new Promise((t,o)=>{let n=r=>{"load"===r.type?t():o(),e.removeEventListener("load",n),e.removeEventListener("error",n)};e.addEventListener("load",n),e.addEventListener("error",n)})}let loadSources=(e,t)=>{let o=[];return dfsSortSources(e).forEach(e=>{documentSources.has(e)||hasInDelayedLoading(e)?!hasInDelayedLoading(e)&&documentSources.get(e).isLoading&&o.push(waitLoadEnd(documentSources.get(e).element)):o.push(t(e))}),Promise.all(o)},loadStyle=e=>new Promise((t,o)=>{let n=document.createElement("link");n.rel="stylesheet",n.href=e,waitLoadEnd(n).then(()=>t()).catch(()=>o()).finally(()=>{documentSources.get(e).isLoading=!1}),documentSources.set(e,{element:n,isLoading:!0}),insertElement("link",n)}),loadScript=(e,t,o)=>new Promise((n,r)=>{let s=document.createElement("script");s.src=e,null!==t&&(s.id=t),null!==o&&(s.async=o),waitLoadEnd(s).then(()=>n()).catch(()=>r()).finally(()=>{documentSources.get(e).isLoading=!1}),documentSources.set(e,{element:s,isLoading:!0}),insertElement("script",s)}),insertElement=(e,t)=>{document.getElementsByTagName(e)[0].insertAdjacentElement("beforebegin",t)},dfsSortSources=e=>{let t=[],o=new Set,n=(t,o,r)=>{o.add(t);let{deps:s}=e[t];s&&s.forEach(e=>{o.has(e)||n(e,o,r)}),r.push(t)};return Object.keys(e).forEach(e=>{o.has(e)||n(e,o,t)}),t.map(t=>getSourcePath(e[t]))},getSourcePath=e=>"string"==typeof e?e:"object"==typeof e?e.src:void console.warn(`Unexpected type of script data: ${typeof e}`),hasInDelayedLoading=e=>{let t=e.split("/"),o=t[t.length-1].split("."),n="class"===o[1],r=o[0];return!!n&&!!existClass(r)},existClass=function(e){return Function("return typeof "+e+' == "function"')()};

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.