File size: 2,173 Bytes
a16b9c7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
// 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();
})();