Download jump/index.html from SANDDIDIT/ghost: direct link, hf CLI and curl.
- Browser
- Download file 5.89 kB
-
https://huggingface.co/spaces/SANDDIDIT/ghost/resolve/main/jump/index.html
- Command line
-
hf download hf://spaces/SANDDIDIT/ghost/jump/index.html
-
curl -L -o index.html https://huggingface.co/spaces/SANDDIDIT/ghost/resolve/main/jump/index.html
5.89 kB
| <html><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"> | |
| <title>SCHEMA JUMP</title> | |
| <style> | |
| html,body{margin:0;height:100%;background:#03050b;color:#f3e2b3;font:14px system-ui;overflow:hidden} | |
| #ui{position:fixed;left:0;right:0;bottom:0;padding:12px 16px 18px;background:linear-gradient(transparent,#03050bee 40%)} | |
| #ui .ends{display:flex;justify-content:space-between;font-size:12px;letter-spacing:1px;opacity:.85} | |
| input[type=range]{width:100%;accent-color:#c9a75d;height:28px} | |
| #title{position:fixed;top:10px;left:14px;font-weight:800;letter-spacing:3px} | |
| #card{position:fixed;left:14px;top:44px;max-width:min(380px,80vw);background:#0b1222ee;border:1px solid #c9a75d;border-radius:10px;padding:10px;display:none} | |
| #card a{color:#7fc4ff}#src{font-size:11px;opacity:.6;margin-top:4px} | |
| </style> | |
| <script type="importmap">{"imports":{"three":"https://unpkg.com/three@0.160.0/build/three.module.js","three/addons/":"https://unpkg.com/three@0.160.0/examples/jsm/"}}</script> | |
| </head><body> | |
| <div id="title">⬆️ SCHEMA JUMP</div> | |
| <div id="card"></div> | |
| <div id="ui"><div class="ends"><span>▭ FLAT</span><span>▣ CUBE</span><span>◯ SPHERE</span></div> | |
| <input id="j" type="range" min="0" max="2" step="0.001" value="0"> | |
| <div id="src"></div></div> | |
| <script type="module"> | |
| import * as THREE from 'three'; | |
| import {OrbitControls} from 'three/addons/controls/OrbitControls.js'; | |
| const R=new THREE.WebGLRenderer({antialias:true});R.setPixelRatio(devicePixelRatio);R.setSize(innerWidth,innerHeight);document.body.prepend(R.domElement); | |
| const scene=new THREE.Scene(),cam=new THREE.PerspectiveCamera(55,innerWidth/innerHeight,.1,500);cam.position.set(0,0,34); | |
| const ctl=new OrbitControls(cam,R.domElement);ctl.enableDamping=true; | |
| scene.add(new THREE.AmbientLight(0xffffff,.6));const L=new THREE.PointLight(0xffe3a0,2,200);L.position.set(10,20,30);scene.add(L); | |
| function csv(t){const rows=[];let row=[],f='',q=false;for(let i=0;i<t.length;i++){const c=t[i]; | |
| if(q){if(c=='"'){if(t[i+1]=='"'){f+='"';i++}else q=false}else f+=c} | |
| else if(c=='"')q=true;else if(c==','){row.push(f);f=''}else if(c=='\n'){row.push(f);rows.push(row);row=[];f=''}else if(c!='\r')f+=c} | |
| if(f||row.length){row.push(f);rows.push(row)}const h=rows.shift();return rows.filter(r=>r.length>1).map(r=>Object.fromEntries(h.map((k,i)=>[k,r[i]||''])))} | |
| const SOURCES=['/plan/master_plan_v1.0.csv','/templates/isic_rev4_spine_v1.0.csv']; | |
| let items=[]; | |
| for(const s of SOURCES){try{const t=await (await fetch(s)).text();csv(t).forEach(r=>items.push({r,src:s}))}catch(e){}} | |
| document.getElementById('src').textContent=`${items.length} rows · from ${SOURCES.join(' + ')} · same rows, three shapes`; | |
| const N=items.length,cols=Math.ceil(Math.sqrt(N)*1.6),side=Math.ceil(Math.cbrt(N)); | |
| const color=r=>{const s=(r.status||'').toLowerCase();return s.startsWith('did')||s.startsWith('contribute')?0x37d67a:s.includes('partly')?0xf2c94c:s.includes('do we')?0xff5a5a:0x7fc4ff}; | |
| const geo=new THREE.BoxGeometry(.7,.7,.7),nodes=[]; | |
| items.forEach((it,i)=>{ | |
| const m=new THREE.Mesh(geo,new THREE.MeshStandardMaterial({color:color(it.r),emissive:color(it.r),emissiveIntensity:.25})); | |
| const flat=new THREE.Vector3((i%cols-cols/2)*1.1,-(Math.floor(i/cols)-N/cols/2)*1.1,0); | |
| const cube=new THREE.Vector3((i%side-side/2)*2,(Math.floor(i/side)%side-side/2)*2,(Math.floor(i/side/side)-side/2)*2); | |
| const y=1-2*(i+.5)/N,rad=Math.sqrt(1-y*y),th=i*2.399963; | |
| const sph=new THREE.Vector3(Math.cos(th)*rad,y,Math.sin(th)*rad).multiplyScalar(12); | |
| m.userData={it,flat,cube,sph};nodes.push(m);scene.add(m)}); | |
| // gold chains: link rows sharing a module / section | |
| const groups={};nodes.forEach(n=>{const k=n.userData.it.r.module||n.userData.it.r.section||n.userData.it.r.ISIC_section||n.userData.it.src;(groups[k]=groups[k]||[]).push(n)}); | |
| const pairs=[];Object.values(groups).forEach(g=>{for(let i=1;i<g.length;i++)pairs.push([g[i-1],g[i]])}); | |
| const lg=new THREE.BufferGeometry();const lp=new Float32Array(pairs.length*6);lg.setAttribute('position',new THREE.BufferAttribute(lp,3)); | |
| const chains=new THREE.LineSegments(lg,new THREE.LineBasicMaterial({color:0xd4af37,transparent:true,opacity:.7}));scene.add(chains); | |
| // Mr. T: a slow time ring | |
| const ring=new THREE.Mesh(new THREE.TorusGeometry(14,.06,8,128),new THREE.MeshBasicMaterial({color:0xd4af37}));scene.add(ring); | |
| const slider=document.getElementById('j');const tmp=new THREE.Vector3(); | |
| function place(v){nodes.forEach(n=>{const d=n.userData; | |
| if(v<=1)tmp.lerpVectors(d.flat,d.cube,v);else tmp.lerpVectors(d.cube,d.sph,v-1);n.position.copy(tmp)}); | |
| pairs.forEach((p,i)=>{lp.set([p[0].position.x,p[0].position.y,p[0].position.z,p[1].position.x,p[1].position.y,p[1].position.z],i*6)});lg.attributes.position.needsUpdate=true; | |
| chains.material.opacity=.15+.35*v;ring.material.opacity=v/2;ring.visible=v>.2} | |
| slider.oninput=()=>place(+slider.value);place(0); | |
| const ray=new THREE.Raycaster(),ptr=new THREE.Vector2(),card=document.getElementById('card'); | |
| R.domElement.addEventListener('click',e=>{ptr.set(e.clientX/innerWidth*2-1,-e.clientY/innerHeight*2+1);ray.setFromCamera(ptr,cam); | |
| const h=ray.intersectObjects(nodes)[0];if(!h){card.style.display='none';return} | |
| const {it}=h.object.userData;const r=it.r;const link=Object.values(r).find(v=>/^https?:\/\//.test(v)); | |
| card.innerHTML=Object.entries(r).filter(([k,v])=>v&&!/^https?:/.test(v)).slice(0,7).map(([k,v])=>`<b>${k}</b>: ${v}`).join('<br>')+(link?`<br><a href="${link}" target=_blank>open ↗</a>`:'')+`<div id=src>${it.src}</div>`;card.style.display='block'}); | |
| addEventListener('resize',()=>{cam.aspect=innerWidth/innerHeight;cam.updateProjectionMatrix();R.setSize(innerWidth,innerHeight)}); | |
| (function loop(t){ring.rotation.z=t/6000;ring.rotation.x=Math.PI/2.4;nodes.forEach((n,i)=>n.rotation.y=t/2000+i);ctl.update();R.render(scene,cam);requestAnimationFrame(loop)})(0); | |
| </script></body></html> | |