Mirror bounce for every MMR row: live link + Wayback + archive.today + Software Heritage
a16b9c7 verified Download mirror.js from SANDDIDIT/ghost: direct link, hf CLI and curl.
- Browser
- Download file 2.17 kB
-
https://huggingface.co/spaces/SANDDIDIT/ghost/resolve/main/mirror.js
- Command line
-
hf download hf://spaces/SANDDIDIT/ghost/mirror.js
-
curl -L -o mirror.js https://huggingface.co/spaces/SANDDIDIT/ghost/resolve/main/mirror.js
2.17 kB
| // Every MMR row bounces: live ↗ · Wayback ⟲ · archive.today ⟲ · Software Heritage ⟲ (code hosts) | |
| (function(){ | |
| const WB=u=>'https://web.archive.org/web/2/'+u; | |
| const AT=u=>'https://archive.ph/newest/'+u; | |
| const SH=u=>'https://archive.softwareheritage.org/browse/origin/directory/?origin_url='+encodeURIComponent(u); | |
| const code=u=>/github\.com|gitlab\.com|bitbucket\.org|huggingface\.co/.test(u); | |
| function patch(){ | |
| if(typeof draw!=='function'||typeof ROWS==='undefined'){return setTimeout(patch,300);} | |
| const hd=document.getElementById('hd'); | |
| const old=draw; | |
| window.draw=draw=function(){ | |
| 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 withLink=v.filter(r=>String(r.redirect||'').startsWith('http')).length; | |
| $('count').textContent=`${v.length} of ${ROWS.length} rows · ${withLink} endpoints · every one mirrored · nothing saved`; | |
| if(!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" title="Wayback">⟲WB</a> <a href="${AT(u)}" target="_blank" title="archive.today">⟲AT</a>${code(u)?` <a href="${SH(u)}" target="_blank" title="Software Heritage">⟲SH</a>`:''}</td>`:'<td>·</td>'; | |
| return '<tr>'+cells+m+'</tr>';}).join(''); | |
| }; | |
| ['q','fSuite'].forEach(id=>{const e=$(id);const n=e.cloneNode(true);e.replaceWith(n);n.addEventListener('input',()=>draw());}); | |
| document.querySelectorAll('#hd th[data-k]').forEach(th=>th.onclick=()=>{sd=sk===th.dataset.k?-sd:1;sk=th.dataset.k;draw();}); | |
| const wait=()=>{if(ROWS.length)draw();else setTimeout(wait,300);};wait(); | |
| } | |
| patch(); | |
| })(); | |