Spaces:
Running
Running
Download assets/explore/gallery-links.js from SimWorld-AI/Code4Scene: direct link, hf CLI and curl.
- Browser
- Download file 1.95 kB
-
https://huggingface.co/spaces/SimWorld-AI/Code4Scene/resolve/main/assets/explore/gallery-links.js
- Command line
-
hf download hf://spaces/SimWorld-AI/Code4Scene/assets/explore/gallery-links.js
-
curl -L -o gallery-links.js https://huggingface.co/spaces/SimWorld-AI/Code4Scene/resolve/main/assets/explore/gallery-links.js
1.95 kB
| // Add links only when a verified scene exists in the published release index. | |
| (()=>{ | |
| const own=document.currentScript?.src;if(!own)return; | |
| const site=new URL('../../',own),url=(cid,key)=>{const u=new URL('gallery/explore.html',site);if(cid)u.searchParams.set('case',cid);if(key)u.searchParams.set('model',key);return u.href;}; | |
| const make=(href,label,className='explore-link')=>{const a=document.createElement('a');a.href=href;a.textContent=label;a.className=className;a.dataset.exploreAdded='true';return a;}; | |
| fetch(new URL('data/explore-scenes.json?v=20261019explore1',site)).then(r=>{if(!r.ok)throw new Error('No scene index');return r.json();}).then(data=>{ | |
| const cases=new Map(data.cases.map(c=>[c.slug,c])); | |
| for(const nav of document.querySelectorAll('.gal-switch'))if(!nav.querySelector('[data-explore-added]'))nav.append(make(url(),'Explore in 3D','')); | |
| for(const figure of document.querySelectorAll('figure.gal-tile')){ | |
| const group=figure.querySelector('[data-group]')?.dataset.group;if(!group)continue; | |
| const [model,slug]=group.split('/');if(cases.get(slug)?.models[model])figure.append(make(url(slug,model),'Explore in 3D ↗')); | |
| } | |
| for(const section of document.querySelectorAll('.gal-case')){ | |
| const group=section.querySelector('.gal-views [data-group]')?.dataset.group;if(!group)continue; | |
| const [model,slug]=group.split('/');if(cases.get(slug)?.models[model])section.querySelector('.gal-case-head')?.append(make(url(slug,model),'Explore in 3D ↗')); | |
| } | |
| const crumb=document.querySelector('.gal-crumb'),key=location.pathname.match(/\/model\/([^/]+)\.html$/)?.[1]; | |
| if(crumb&&key&&data.models.some(m=>m.key===key))crumb.append(make(url(null,key),'Explore this agent in 3D ↗','explore-crumb-link')); | |
| const label=document.querySelector('[data-explore-count]');if(label)label.textContent=data.ready_scenes+' scenes · '+data.models.length+' agents'; | |
| }).catch(()=>{}); | |
| })(); | |