PageSourceSearch

https://www.nonasties.shop/cdn/shop/t/22/assets/image-coordinator.js?v=164281591090222588631779095061

js nonasties.shop collected 2026-10-09 23:06:52 UTC 3,894 bytes, 2 lines download raw bytes

1class ImageCoordinator{constructor(){this.io=null,this.ro=null,this.elements=new Map,this.resizeElements=new Set,this.resizeRAFs=new Map,this.config={lazyLoadMargin:"0px 0px -5%",lazyLoadThreshold:.01,resizeThrottle:16}}init(){this.io&&this.ro||(!this.io&&"IntersectionObserver"in window&&(this.io=new IntersectionObserver(entries=>this.handleIntersections(entries),{rootMargin:this.config.lazyLoadMargin,threshold:this.config.lazyLoadThreshold})),!this.ro&&"ResizeObserver"in window?this.ro=new ResizeObserver(entries=>this.handleResize(entries)):this.ro||this.setupResizeFallback())}registerLazyLoad(element,options={}){return this.io||this.init(),this.io?(this.elements.set(element,{mode:"lazy",onIntersect:options.onIntersect}),this.io.observe(element),()=>this.unregisterLazyLoad(element)):(options.onIntersect?.(),()=>{})}registerResize(target,image,callback){return this.ro||this.init(),this.ro?(this.elements.set(image,{...this.elements.get(image),resizeTarget:target,onResize:callback,lastWidth:0}),this.resizeElements.add(image),this.ro.observe(target),()=>this.unregisterResize(target,image)):(callback(target.offsetWidth||0),()=>{})}unregisterLazyLoad(element){this.io&&this.io.unobserve(element);const data=this.elements.get(element);data&&data.mode==="lazy"&&this.elements.delete(element)}unregisterResize(target,image){this.ro&&this.ro.unobserve(target),this.resizeElements.delete(image);const rafId=this.resizeRAFs.get(image);rafId&&(cancelAnimationFrame(rafId),this.resizeRAFs.delete(image));const data=this.elements.get(image);data&&!data.mode?this.elements.delete(image):data&&(delete data.resizeTarget,delete data.onResize,delete data.lastWidth)}handleIntersections(entries){entries.forEach(entry=>{if(!entry.isIntersecting)return;const element=entry.target,data=this.elements.get(element);if(!(!data||data.mode!=="lazy")){this.io.unobserve(element);try{data.onIntersect?.()}catch(error){console.error("[ImageCoordinator] Intersection callback error:",error)}this.elements.delete(element)}})}handleResize(entries){entries.forEach(entry=>{const target=entry.target;for(const[image,data]of this.elements.entries()){if(data.resizeTarget!==target||this.resizeRAFs.has(image))continue;const rafId=requestAnimationFrame(()=>{this.resizeRAFs.delete(image);const width=Math.ceil(entry.contentRect.width||0),lastWidth=data.lastWidth||0;if(!(Math.abs(width-lastWidth)<1)){data.lastWidth=width;try{data.onResize?.(width)}catch(error){console.error("[ImageCoordinator] Resize callback error:",error)}}});this.resizeRAFs.set(image,rafId)}})}setupResizeFallback(){let timeout;const handleWindowResize=()=>{clearTimeout(timeout),timeout=setTimeout(()=>{for(const[image,data]of this.elements.entries()){if(!data.resizeTarget||!data.onResize)continue;const width=data.resizeTarget.offsetWidth||0,lastWidth=data.lastWidth||0;if(!(Math.abs(width-lastWidth)<1)){data.lastWidth=width;try{data.onResize(width)}catch(error){console.error("[ImageCoordinator] Resize fallback error:",error)}}}},100)};window.addEventListener("resize",handleWindowResize)}getStats(){let lazyCount=0,resizeCount=0;for(const data of this.elements.values())data.mode==="lazy"&&lazyCount++,data.resizeTarget&&resizeCount++;return{total:this.elements.size,lazy:lazyCount,resize:resizeCount,observers:{io:this.io?"initialized":"not initialized",ro:this.ro?"initialized":"fallback"},pendingRAFs:this.resizeRAFs.size}}destroy(){this.io&&(this.io.disconnect(),this.io=null),this.ro&&(this.ro.disconnect(),this.ro=null);for(const rafId of this.resizeRAFs.values())cancelAnimationFrame(rafId);this.elements.clear(),this.resizeElements.clear(),this.resizeRAFs.clear()}}export const imageCoordinator=new ImageCoordinator;typeof window<"u"&&(window.FoxTheme=window.FoxTheme||{},window.FoxTheme.imageCoordinator=imageCoordinator);
2//# sourceMappingURL=/cdn/shop/t/22/assets/image-coordinator.js.map?v=164281591090222588631779095061

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.