Mirror bounce for every MMR row: live link + Wayback + archive.today + Software Heritage
Browse files
mirror.js
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// Every MMR row bounces: live ↗ · Wayback ⟲ · archive.today ⟲ · Software Heritage ⟲ (code hosts)
|
| 2 |
+
(function(){
|
| 3 |
+
const WB=u=>'https://web.archive.org/web/2/'+u;
|
| 4 |
+
const AT=u=>'https://archive.ph/newest/'+u;
|
| 5 |
+
const SH=u=>'https://archive.softwareheritage.org/browse/origin/directory/?origin_url='+encodeURIComponent(u);
|
| 6 |
+
const code=u=>/github\.com|gitlab\.com|bitbucket\.org|huggingface\.co/.test(u);
|
| 7 |
+
function patch(){
|
| 8 |
+
if(typeof draw!=='function'||typeof ROWS==='undefined'){return setTimeout(patch,300);}
|
| 9 |
+
const hd=document.getElementById('hd');
|
| 10 |
+
const old=draw;
|
| 11 |
+
window.draw=draw=function(){
|
| 12 |
+
const q=$('q').value.toLowerCase(),fs=$('fSuite').value;
|
| 13 |
+
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);
|
| 14 |
+
const withLink=v.filter(r=>String(r.redirect||'').startsWith('http')).length;
|
| 15 |
+
$('count').textContent=`${v.length} of ${ROWS.length} rows · ${withLink} endpoints · every one mirrored · nothing saved`;
|
| 16 |
+
if(!hd.dataset.m){hd.insertAdjacentHTML('beforeend','<th>mirror link</th>');hd.dataset.m=1;}
|
| 17 |
+
$('bd').innerHTML=v.map(r=>{const u=String(r.redirect||'');
|
| 18 |
+
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('');
|
| 19 |
+
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>';
|
| 20 |
+
return '<tr>'+cells+m+'</tr>';}).join('');
|
| 21 |
+
};
|
| 22 |
+
['q','fSuite'].forEach(id=>{const e=$(id);const n=e.cloneNode(true);e.replaceWith(n);n.addEventListener('input',()=>draw());});
|
| 23 |
+
document.querySelectorAll('#hd th[data-k]').forEach(th=>th.onclick=()=>{sd=sk===th.dataset.k?-sd:1;sk=th.dataset.k;draw();});
|
| 24 |
+
const wait=()=>{if(ROWS.length)draw();else setTimeout(wait,300);};wait();
|
| 25 |
+
}
|
| 26 |
+
patch();
|
| 27 |
+
})();
|