Download index.html from SANDDIDIT/ghost: direct link, hf CLI and curl.
- Browser
- Download file 22.2 kB
-
https://huggingface.co/spaces/SANDDIDIT/ghost/resolve/main/index.html
- Command line
-
hf download hf://spaces/SANDDIDIT/ghost/index.html
-
curl -L -o index.html https://huggingface.co/spaces/SANDDIDIT/ghost/resolve/main/index.html
22.2 kB
| <html><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1,viewport-fit=cover"> | |
| <title>GHOST · Mirror Registry · XYZTN</title> | |
| <link href="https://unpkg.com/maplibre-gl@5.6.0/dist/maplibre-gl.css" rel="stylesheet"> | |
| <script src="https://unpkg.com/maplibre-gl@5.6.0/dist/maplibre-gl.js"></script> | |
| <script src="https://unpkg.com/deck.gl@9.1.0/dist.min.js"></script> | |
| <script src="https://cdn.jsdelivr.net/npm/papaparse@5.4.1/papaparse.min.js"></script> | |
| <script src="https://cdn.jsdelivr.net/npm/satellite.js@5.0.0/dist/satellite.min.js"></script> | |
| <style> | |
| *{box-sizing:border-box} | |
| html,body{margin:0;height:100%;background:#03050a;color:#cfe;font-family:-apple-system,Helvetica,sans-serif;overflow:hidden} | |
| #map{position:fixed;inset:0} | |
| .panel{position:fixed;top:0;bottom:0;width:min(420px,92vw);z-index:5;display:flex;flex-direction:column;background:#060c18ee;backdrop-filter:blur(10px);-webkit-backdrop-filter:blur(10px);transition:transform .35s ease;box-shadow:0 0 30px #000} | |
| #cat{left:0;transform:translateX(-105%);border-right:1px solid #1b2a44} | |
| #reg{right:0;transform:translateX(105%);border-left:1px solid #1b2a44} | |
| .panel.open{transform:translateX(0)} | |
| .ph{display:flex;align-items:center;justify-content:space-between;padding:calc(10px + env(safe-area-inset-top)) 12px 10px;background:#0a1426} | |
| .ph h1{margin:0;font-size:15px;letter-spacing:2px} | |
| .ph h1 a{color:#00ff88;text-decoration:none} | |
| .x{font-size:26px;background:none;border:none;color:#cfe;padding:0 6px} | |
| .scroll{overflow:auto;flex:1;min-height:0;padding:8px;-webkit-overflow-scrolling:touch} | |
| details{margin:6px 0;border:1px solid #1e3050;border-radius:12px;background:#0a1222} | |
| summary{font-size:20px;padding:14px;cursor:pointer;font-weight:600} | |
| .item{display:grid;grid-template-columns:30px 1fr auto;align-items:center;gap:8px;padding:11px 12px;border-top:1px solid #12203a;font-size:16px} | |
| .item input{width:24px;height:24px} | |
| .item small{display:block;color:#7a9;font-size:11px} | |
| .item a{color:#cfe;text-decoration:none} | |
| .st{font-size:11px;padding:3px 7px;border-radius:8px;background:#222;white-space:nowrap} | |
| .ok{background:#164a2a}.bad{background:#5a1a1a}.wait{background:#4a3a10} | |
| .row{display:grid;grid-template-columns:70px 1fr;gap:8px;align-items:center;padding:8px 12px;font-size:15px} | |
| select,input[type=text]{width:100%;font-size:16px;padding:10px;background:#0b1220;color:#cfe;border:1px solid #2ec4ff;border-radius:8px} | |
| .fab{position:fixed;z-index:4;bottom:calc(18px + env(safe-area-inset-bottom));padding:14px 18px;border-radius:30px;border:1px solid #2ec4ff;background:#0b1220dd;color:#cfe;font-size:16px;font-weight:600;backdrop-filter:blur(6px)} | |
| #fabCat{left:14px}#fabReg{right:14px;border-color:#00ff88} | |
| #xyztn{position:fixed;left:50%;transform:translateX(-50%);bottom:calc(80px + env(safe-area-inset-bottom));z-index:3;background:#000b;padding:8px 10px;border-radius:10px;font:12px ui-monospace,Menlo,monospace;color:#9fe;max-width:92vw;pointer-events:none} | |
| #clock{position:fixed;right:12px;top:calc(10px + env(safe-area-inset-top));z-index:3;font-size:18px;color:#ff4fa3;text-shadow:0 0 6px #000} | |
| table{border-collapse:collapse;width:100%;font-size:13px} | |
| th{position:sticky;top:0;background:#0b1830;cursor:pointer;text-align:left;padding:8px 6px;white-space:nowrap} | |
| td{padding:7px 6px;border-bottom:1px solid #12203a;vertical-align:top} | |
| td a{color:#7fe3ff;text-decoration:none} | |
| .maplibregl-ctrl-bottom-right{bottom:70px} | |
| </style></head><body> | |
| <div id="map"></div> | |
| <div id="clock">MR. T · <span id="t"></span></div> | |
| <div id="xyztn">Tap anything · X Y Z T N</div> | |
| <button class="fab" id="fabCat">☰ Catalog</button> | |
| <button class="fab" id="fabReg">◉ Registry</button> | |
| <div class="panel" id="cat"> | |
| <div class="ph"><h1>CATALOG · <a href="https://huggingface.co/datasets/autobahn247365/mmr">MMR</a></h1><button class="x" data-close="cat">✕</button></div> | |
| <div class="scroll" id="catalog"></div> | |
| </div> | |
| <div class="panel" id="reg"> | |
| <div class="ph"><h1>MIRROR REGISTRY · <span id="mver">finding root…</span></h1><button class="x" data-close="reg">✕</button></div> | |
| <div style="padding:8px;display:grid;gap:6px"><input type="text" id="q" placeholder="Search the registry…"><select id="fSuite"></select><div id="count" style="font-size:12px;color:#8ab"></div></div> | |
| <div class="scroll" style="padding:0"><table><thead><tr id="hd"></tr></thead><tbody id="bd"></tbody></table></div> | |
| </div> | |
| <script> | |
| const $=id=>document.getElementById(id); | |
| const OWNER='autobahn247365',DS=OWNER+'/mmr',HF='https://huggingface.co/'; | |
| const tog=id=>{const p=$(id),o=!p.classList.contains('open');document.querySelectorAll('.panel').forEach(x=>x.classList.remove('open'));if(o)p.classList.add('open');}; | |
| $('fabCat').onclick=()=>tog('cat');$('fabReg').onclick=()=>tog('reg'); | |
| document.querySelectorAll('[data-close]').forEach(b=>b.onclick=()=>$(b.dataset.close).classList.remove('open')); | |
| async function B(urls){let last;for(let i=0;i<urls.length;i++){try{const r=await fetch(urls[i]);if(r.ok){const t=await r.text();return [JSON.parse(t),i];}last=r.status;}catch(e){last=e.message||e;}}throw last;} | |
| const J=async u=>(await B(Array.isArray(u)?u:[u]))[0]; | |
| const GH=(repo,path)=>[`https://cdn.jsdelivr.net/gh/${repo}@master/${path}`,`https://raw.githubusercontent.com/${repo}/master/${path}`]; | |
| const M=i=>i===0?'source':'mirror '+i; | |
| const CATALOG=[ | |
| {folder:'✈ AIR',items:[{id:'flights',name:'Live flights worldwide',src:'OpenSky · adsb.lol · airplanes.live',url:'https://opensky-network.org',z:'altitude'},{id:'routes',name:'City-to-city flight paths',src:'Node mesh',url:HF+'spaces/'+OWNER+'/ghost',z:'arc'}]}, | |
| {folder:'🛰 SPACE',items:[{id:'iss',name:'ISS live position',src:'wheretheiss.at · open-notify',url:'https://wheretheiss.at',z:'orbit'},{id:'sats',name:'Space stations + satellites',src:'CelesTrak · TLE API mirror',url:'https://celestrak.org',z:'orbit'}]}, | |
| {folder:'🌐 INTERNET · COMMUNICATION',items:[{id:'cables',name:'Undersea internet cables',src:'Submarine Cable Map · GitHub mirrors',url:'https://www.submarinecablemap.com',z:'sea floor'},{id:'comms',name:'Communication arcs · data · voice · video',src:'Node mesh',url:HF+'spaces/'+OWNER+'/ghost',z:'arc'}]}, | |
| {folder:'🌋 EARTH',items:[{id:'quakes',name:'Earthquakes · last 24h · true depth',src:'USGS · EMSC mirror',url:'https://earthquake.usgs.gov',z:'below ground'}]}, | |
| {folder:'🏙 CITIES',items:[{id:'city3d',name:'3D skylines · every city',src:'OpenStreetMap · OpenFreeMap',url:'https://openfreemap.org',z:'building height'}]}, | |
| {folder:'🗺 MAP TYPES',maps:[['Liberty','https://tiles.openfreemap.org/styles/liberty'],['Bright','https://tiles.openfreemap.org/styles/bright'],['Positron','https://tiles.openfreemap.org/styles/positron'],['Satellite · Esri','raster:https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}'],['Topo · OpenTopoMap','raster:https://a.tile.opentopomap.org/{z}/{x}/{y}.png'],['Night lights · NASA','raster:https://gibs.earthdata.nasa.gov/wmts/epsg3857/best/VIIRS_CityLights_2012/default/GoogleMapsCompatible_Level8/{z}/{y}/{x}.jpg']]}, | |
| ]; | |
| const ON={flights:true,routes:true,iss:true,sats:true,cables:true,comms:true,quakes:true,city3d:true}; | |
| let html=''; | |
| CATALOG.forEach(f=>{html+=`<details open><summary>${f.folder}</summary>`; | |
| if(f.items)f.items.forEach(it=>{html+=`<label class="item"><input type="checkbox" data-id="${it.id}" checked><span><a href="${it.url}" target="_blank">${it.name}</a><small>${it.src} · Z = ${it.z}</small></span><span class="st wait" id="st-${it.id}">…</span></label>`;}); | |
| if(f.maps)html+=`<div class="row"><span>Base</span><select id="basemap">${f.maps.map(m=>`<option value="${m[1]}">${m[0]}</option>`).join('')}</select></div>`; | |
| html+='</details>';}); | |
| html+=`<details open><summary>🧩 SAND SPACES · live from Hugging Face</summary><div id="spaces"><div class="item"><span></span><span>Finding every Space…</span><span></span></div></div></details>`; | |
| html+=`<details><summary>📁 MMR FILES · root</summary><div id="files"></div></details>`; | |
| html+=`<details open><summary>⇕ DEPTH · XYZTN</summary><div class="row"><span>Z depth</span><input type="range" id="zx" min="1" max="60" value="15"></div><div class="row"><span>View</span><select id="view"><option value="3d">3D tilted</option><option value="globe">Globe</option><option value="flat">Flat</option></select></div><div class="row"><span>City</span><select id="city"></select></div></details>`; | |
| $('catalog').innerHTML=html; | |
| function st(id,s,cls){const e=$('st-'+id);if(e){e.textContent=s;e.className='st '+cls;}} | |
| document.querySelectorAll('[data-id]').forEach(cb=>cb.onchange=()=>{ON[cb.dataset.id]=cb.checked;if(cb.dataset.id==='city3d'&&map.getLayer('city3d'))map.setLayoutProperty('city3d','visibility',cb.checked?'visible':'none');render();}); | |
| J(HF+'api/spaces?author='+OWNER+'&limit=500&full=true').then(list=>{ | |
| list.sort((a,b)=>(b.lastModified||'').localeCompare(a.lastModified||'')); | |
| $('spaces').innerHTML=list.map(s=>{const n=s.id.split('/')[1];return `<div class="item"><span>▸</span><span><a href="${HF}spaces/${s.id}" target="_blank">${n}</a><small>${s.sdk||''} · ${(s.lastModified||'').slice(0,10)}</small></span><a class="st ok" href="https://${s.id.replace('/','-').replace(/_/g,'-').toLowerCase()}.${s.sdk==='static'?'static.':''}hf.space" target="_blank">open ↗</a></div>`;}).join('')+`<div class="item"><span>▸</span><span><a href="${HF}${OWNER}" target="_blank">All of ${OWNER} · incl. private</a><small>private Spaces show when you're signed in</small></span><span></span></div>`; | |
| }).catch(e=>{$('spaces').innerHTML=`<div class="item"><span></span><span><a href="${HF}${OWNER}" target="_blank">Open all Spaces ↗</a></span><span class="st bad">${e}</span></div>`;}); | |
| const N=[["Tampa",-82.4572,27.9506],["Las Vegas",-115.172,36.121],["Tokyo",139.7671,35.6812],["New York",-74.006,40.7128],["London",-0.1276,51.5072],["Paris",2.3522,48.8566],["Dubai",55.2744,25.1972],["Singapore",103.8519,1.2903],["Hong Kong",114.1694,22.3193],["Shanghai",121.4737,31.2304],["Sydney",151.2093,-33.8688],["São Paulo",-46.6333,-23.5505],["San Juan",-66.1057,18.4655],["Chicago",-87.6298,41.8781],["Los Angeles",-118.2437,34.0522],["Toronto",-79.3832,43.6532],["Mexico City",-99.1332,19.4326],["Miami",-80.1918,25.7617],["Seoul",126.978,37.5665],["Mumbai",72.8777,19.076],["Lagos",3.3792,6.5244],["Cairo",31.2357,30.0444],["Istanbul",28.9784,41.0082],["Berlin",13.405,52.52],["Johannesburg",28.0473,-26.2041],["Buenos Aires",-58.3816,-34.6037],["Frankfurt",8.6821,50.1109],["Honolulu",-157.8583,21.3069]]; | |
| $('city').innerHTML='<option value="">World</option>'+N.map((n,i)=>`<option value="${i}">${n[0]}</option>`).join(''); | |
| function rasterStyle(u){return{version:8,glyphs:'https://tiles.openfreemap.org/fonts/{fontstack}/{range}.pbf',sources:{r:{type:'raster',tiles:[u],tileSize:256,maxzoom:u.includes('VIIRS')?8:18,attribution:'© providers'}},layers:[{id:'r',type:'raster',source:'r'}]};} | |
| const map=new maplibregl.Map({container:'map',style:'https://tiles.openfreemap.org/styles/liberty',center:[-40,28],zoom:innerWidth<700?0.9:1.8,pitch:45,antialias:true,maxPitch:85}); | |
| map.addControl(new maplibregl.NavigationControl(),'bottom-right'); | |
| const overlay=new deck.MapboxOverlay({interleaved:false,layers:[]});map.addControl(overlay); | |
| function add3d(){if(map.getSource('openmaptiles')&&!map.getLayer('city3d'))map.addLayer({id:'city3d',type:'fill-extrusion',source:'openmaptiles','source-layer':'building',minzoom:13,layout:{visibility:ON.city3d?'visible':'none'},paint:{'fill-extrusion-color':['interpolate',['linear'],['coalesce',['get','render_height'],10],0,'#2a0a40',60,'#7a2cff',200,'#ffb000',400,'#ff4fa3'],'fill-extrusion-height':['coalesce',['get','render_height'],10],'fill-extrusion-base':['coalesce',['get','render_min_height'],0],'fill-extrusion-opacity':.9}}); | |
| st('city3d',map.getSource('openmaptiles')?'live':'vector maps only',map.getSource('openmaptiles')?'ok':'wait');} | |
| map.on('style.load',()=>{if($('view').value==='globe')map.setProjection({type:'globe'});add3d();}); | |
| $('basemap').onchange=e=>{const v=e.target.value;map.setStyle(v.startsWith('raster:')?rasterStyle(v.slice(7)):v);}; | |
| $('view').onchange=e=>{const v=e.target.value;map.setProjection({type:v==='globe'?'globe':'mercator'});map.easeTo({pitch:v==='flat'?0:50});}; | |
| $('city').onchange=e=>{const v=e.target.value;if(innerWidth<900)$('cat').classList.remove('open');if(v==='')map.flyTo({center:[-40,28],zoom:1.8,pitch:45});else{const n=N[+v];map.flyTo({center:[n[1],n[2]],zoom:15.4,pitch:65,bearing:-20,duration:5000});}}; | |
| $('zx').oninput=render; | |
| const D={flights:[],iss:[],sats:[],cables:[],quakes:[]}; | |
| const routes=[];N.forEach((a,i)=>{for(let j=i+1;j<N.length;j++)if((i*5+j*3)%4===0)routes.push({s:[a[1],a[2]],t:[N[j][1],N[j][2]],n:a[0]+' ⇄ '+N[j][0],k:(i+j)%4});}); | |
| st('routes','live','ok');st('comms','live','ok'); | |
| async function flights(){ | |
| try{const [j,i]=await B(['https://opensky-network.org/api/states/all','https://api.adsb.lol/v2/lat/40/lon/-40/dist/5000','https://api.airplanes.live/v2/point/40/-40/250']); | |
| if(j.states)D.flights=j.states.filter(s=>s[5]!=null&&s[6]!=null).map(s=>({p:[s[5],s[6],(s[7]||s[13]||0)],n:(s[1]||'').trim()||s[0],t:j.time})); | |
| else D.flights=(j.ac||j.aircraft||[]).filter(a=>a.lat!=null).map(a=>({p:[a.lon,a.lat,(+a.alt_baro||0)*0.3048],n:(a.flight||a.hex||'').trim(),t:Date.now()/1000})); | |
| st('flights',D.flights.length+' planes · '+M(i),'ok');}catch(e){st('flights','all mirrors blocked','bad');}render();} | |
| async function iss(){try{const [j,i]=await B(['https://api.wheretheiss.at/v1/satellites/25544','https://api.open-notify.org/iss-now.json']); | |
| if(j.latitude!=null)D.iss=[{p:[j.longitude,j.latitude,j.altitude*1000],n:'ISS',t:j.timestamp}]; | |
| else D.iss=[{p:[+j.iss_position.longitude,+j.iss_position.latitude,420000],n:'ISS',t:j.timestamp}]; | |
| st('iss','live · '+M(i),'ok');}catch(e){st('iss','all mirrors blocked','bad');}render();} | |
| let TLE=[];async function sats(){try{const [j,i]=await B(['https://celestrak.org/NORAD/elements/gp.php?GROUP=stations&FORMAT=json','https://tle.ivanstanojevic.me/api/tle/?search=ISS&page-size=50','https://tle.ivanstanojevic.me/api/tle/?page-size=100']); | |
| if(Array.isArray(j))TLE=j.map(g=>({n:g.OBJECT_NAME,rec:satellite.json2satrec(g)})); | |
| else TLE=(j.member||[]).map(m=>({n:m.name,rec:satellite.twoline2satrec(m.line1,m.line2)})); | |
| TLE=TLE.filter(s=>s.rec);st('sats',TLE.length+' objects · '+M(i),'ok');}catch(e){st('sats','all mirrors blocked','bad');}} | |
| function satPos(){const now=new Date(),gm=satellite.gstime(now);D.sats=TLE.map(s=>{const pv=satellite.propagate(s.rec,now);if(!pv||!pv.position)return null;const g=satellite.eciToGeodetic(pv.position,gm);return{p:[satellite.degreesLong(g.longitude),satellite.degreesLat(g.latitude),g.height*1000],n:s.n,t:now.getTime()/1000};}).filter(Boolean);} | |
| async function cables(){try{const [j,i]=await B(['https://www.submarinecablemap.com/api/v3/cable/cable-geo.json',...GH('telegeography/www.submarinecablemap.com','web/public/api/v3/cable/cable-geo.json')]);D.cables=[];j.features.forEach(f=>{const g=f.geometry,cs=g.type==='MultiLineString'?g.coordinates:[g.coordinates];cs.forEach(c=>D.cables.push({path:c,n:f.properties.name,col:f.properties.color}));});st('cables',j.features.length+' cables · '+M(i),'ok');}catch(e){st('cables','all mirrors blocked','bad');}render();} | |
| async function quakes(){try{const since=new Date(Date.now()-864e5).toISOString().slice(0,19); | |
| const [j,i]=await B(['https://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/all_day.geojson','https://www.seismicportal.eu/fdsnws/event/1/query?format=json&limit=2000&starttime='+since]); | |
| D.quakes=(j.features||[]).map(f=>{const c=f.geometry.coordinates,p=f.properties;const depth=Math.abs(c[2]||p.depth||0);return{p:[c[0],c[1],-depth*1000],m:p.mag||0,n:p.place||p.flynn_region||'',t:(typeof p.time==='number'?p.time:Date.parse(p.time))/1000};}); | |
| st('quakes',D.quakes.length+' quakes · '+M(i),'ok');}catch(e){st('quakes','all mirrors blocked','bad');}render();} | |
| flights();iss();sats();cables();quakes(); | |
| setInterval(flights,20000);setInterval(iss,5000);setInterval(quakes,300000); | |
| function show(o,layer){if(!o||!o.object)return;const ob=o.object,p=ob.p||(ob.s?[...ob.s,0]:ob.path?ob.path[0].concat(0):[o.coordinate[0],o.coordinate[1],0]); | |
| $('xyztn').innerHTML=`<b>N</b> ${ob.n||''} · ${layer}<br><b>X</b> ${(+p[0]).toFixed(3)} <b>Y</b> ${(+p[1]).toFixed(3)} <b>Z</b> ${Math.round(p[2]||0)} m <b>T</b> ${ob.t?new Date(ob.t*1000).toISOString().slice(0,19):new Date().toISOString().slice(0,19)}`;} | |
| function render(){const zx=+$('zx').value,L=[]; | |
| const P=name=>({pickable:true,onHover:o=>show(o,name),onClick:o=>show(o,name)}); | |
| if(ON.quakes)L.push(new deck.ScatterplotLayer({id:'quakes',data:D.quakes,getPosition:d=>[d.p[0],d.p[1],d.p[2]*zx/15],getRadius:d=>20000*Math.max(.5,d.m),getFillColor:[255,90,40,200],...P('quakes')})); | |
| if(ON.cables)L.push(new deck.PathLayer({id:'cables',data:D.cables,getPath:d=>d.path.map(c=>[c[0],c[1],-2000*zx]),getColor:d=>{const h=(d.col||'#40e0ff').replace('#','');return[parseInt(h.slice(0,2),16),parseInt(h.slice(2,4),16),parseInt(h.slice(4,6),16),180];},widthMinPixels:1.5,...P('cables')})); | |
| if(ON.comms)L.push(new deck.ArcLayer({id:'comms',data:routes,getSourcePosition:d=>d.s,getTargetPosition:d=>d.t,getSourceColor:d=>[[64,224,255],[255,176,0],[208,128,255],[255,112,192]][d.k].concat(200),getTargetColor:[255,255,255,120],getHeight:.25,getWidth:2,...P('comms')})); | |
| if(ON.routes)L.push(new deck.ArcLayer({id:'routes',data:routes,getSourcePosition:d=>d.s,getTargetPosition:d=>d.t,getSourceColor:[255,79,163,160],getTargetColor:[255,176,0,160],getHeight:.9,getWidth:1,...P('flight paths')})); | |
| if(ON.flights)L.push(new deck.ScatterplotLayer({id:'flights',data:D.flights,getPosition:d=>[d.p[0],d.p[1],d.p[2]*zx],getRadius:6000,radiusMinPixels:1.5,getFillColor:[255,230,120,220],...P('flights')})); | |
| if(ON.sats)L.push(new deck.ScatterplotLayer({id:'sats',data:D.sats,getPosition:d=>[d.p[0],d.p[1],d.p[2]*zx/15],getRadius:40000,getFillColor:[120,200,255,230],...P('satellites')})); | |
| if(ON.iss)L.push(new deck.ScatterplotLayer({id:'iss',data:D.iss,getPosition:d=>[d.p[0],d.p[1],d.p[2]*zx/15],getRadius:120000,getFillColor:[0,255,136,255],...P('ISS')})); | |
| L.push(new deck.ScatterplotLayer({id:'nodes',data:N,getPosition:d=>[d[1],d[2],0],getRadius:50000,radiusMinPixels:5,getFillColor:[255,79,163,255],pickable:true,onClick:o=>{const i=N.indexOf(o.object);$('city').value=i;$('city').onchange({target:$('city')});}})); | |
| overlay.setProps({layers:L});} | |
| setInterval(()=>{if(TLE.length){satPos();render();}$('t').textContent=new Date().toLocaleTimeString();},2000); | |
| const COLS=['tab','suite','layer','type','status','time','redirect']; | |
| let ROWS=[],sk='suite',sd=1,VIEW=''; | |
| function ver(p){const m=p.match(/v(\d+)\.(\d+)/);return m?(+m[1])*1000+(+m[2]):-1;} | |
| J(HF+'api/datasets/'+DS+'/tree/main?recursive=true').then(tree=>{ | |
| const files=tree.filter(f=>f.type==='file'); | |
| $('files').innerHTML=files.map(f=>`<div class="item"><span>▸</span><span><a href="${HF}datasets/${DS}/blob/main/${f.path}" target="_blank">${f.path}</a><small>${(f.size/1024).toFixed(1)} KB</small></span><span></span></div>`).join(''); | |
| const masters=files.filter(f=>/^mmr_master_v[\d.]+\.csv$/.test(f.path)).sort((a,b)=>ver(b.path)-ver(a.path)); | |
| const pick=(masters[0]||{path:'mmr_master_v1.0.csv'}).path; | |
| $('mver').innerHTML=`<a href="${HF}datasets/${DS}/blob/main/${pick}" target="_blank" style="color:#00ff88;text-decoration:none">${pick}</a>`; | |
| load(HF+'datasets/'+DS+'/resolve/main/'+pick); | |
| }).catch(()=>{$('mver').textContent='mmr_master_v1.0.csv';load(HF+'datasets/'+DS+'/resolve/main/mmr_master_v1.0.csv');}); | |
| function load(src){VIEW=HF+'datasets/'+DS+'/viewer?row='; | |
| Papa.parse(src,{download:true,header:true,skipEmptyLines:true,complete:r=>{ | |
| const keys=r.meta.fields||[];const nameKey=keys.includes('tab')?'tab':keys[1]||keys[0];const linkKey=keys.includes('redirect')?'redirect':keys.find(k=>r.data.some(x=>String(x[k]||'').startsWith('http')))||'redirect'; | |
| ROWS=r.data.map((x,i)=>({...x,_i:i,tab:x[nameKey]||x.gid||x[linkKey],redirect:x[linkKey],suite:x.suite||'Roots'})); | |
| $('fSuite').innerHTML='<option value="">Suite link: all</option>'+[...new Set(ROWS.map(x=>x.suite))].sort().map(s=>`<option>${s}</option>`).join(''); | |
| $('hd').innerHTML=COLS.map(c=>`<th data-k="${c}">${c==='tab'?'name':c} link ⇅</th>`).join(''); | |
| document.querySelectorAll('#hd th').forEach(th=>th.onclick=()=>{sd=sk===th.dataset.k?-sd:1;sk=th.dataset.k;draw();});draw();}, | |
| error:e=>{$('count').textContent='Master did not load: '+e;}});} | |
| ['q','fSuite'].forEach(id=>$(id).addEventListener('input',()=>draw())); | |
| const WB=u=>'https://web.archive.org/web/2/'+u,AT=u=>'https://archive.ph/newest/'+u,SH=u=>'https://archive.softwareheritage.org/browse/origin/directory/?origin_url='+encodeURIComponent(u); | |
| const isCode=u=>/github\.com|gitlab\.com|bitbucket\.org|huggingface\.co/.test(u); | |
| function draw(){const q=$('q').value.toLowerCase(),fs=$('fSuite').value; | |
| const v=ROWS.filter(r=>(!fs||r.suite===fs)&&(!q||Object.values(r).join(' ').toLowerCase().includes(q))).sort((a,b)=>String(a[sk]||'').localeCompare(String(b[sk]||''),undefined,{numeric:true})*sd); | |
| const ep=v.filter(r=>String(r.redirect||'').startsWith('http')).length; | |
| $('count').textContent=`${v.length} of ${ROWS.length} rows · ${ep} endpoints · every one live + mirrored · nothing saved`; | |
| const hd=$('hd');if(hd.children.length&&!hd.dataset.m){hd.insertAdjacentHTML('beforeend','<th>mirror link</th>');hd.dataset.m=1;} | |
| $('bd').innerHTML=v.map(r=>{const u=String(r.redirect||''); | |
| const cells=COLS.map(c=>{const val=(r[c]||'').toString();const href=c==='redirect'&&val?val:VIEW+r._i;return `<td><a href="${href}" target="_blank">${c==='redirect'&&val?'live ↗':val.slice(0,90)||'·'}</a></td>`;}).join(''); | |
| const m=u.startsWith('http')?`<td style="white-space:nowrap"><a href="${WB(u)}" target="_blank">⟲WB</a> <a href="${AT(u)}" target="_blank">⟲AT</a>${isCode(u)?` <a href="${SH(u)}" target="_blank">⟲SH</a>`:''}</td>`:'<td>·</td>'; | |
| return '<tr>'+cells+m+'</tr>';}).join('');} | |
| </script></body></html> | |