User:Acagastya/deadlinks.js

// function deadlinkSearch { const deadlinks = [...document.getElementsByClassName('new')]; if (deadlinks.length) { const message = `${deadlinks.length} deadlinks.\n` + deadlinks.map(el => `${el.innerText}: ${el.title}`).join(',\n'); setTimeout(function {     alert(message);    }, 0); } }

function deadlinkInit { if(mw.config.get('wgNamespaceNumber') != 0) return; let t = document.getElementById('p-article-tools'); if (!t) return; let li = document.createElement('li'); let a = document.createElement('a'); a.setAttribute('href', 'javascript:searchDeadlinks.deadlinkSearch'); a.setAttribute('id', 'deadlink-search'); a.innerText = 'Deadlink search'; li.setAttribute('id', 'ca-deadlinksearch'); li.appendChild(a);

const tBody = [...t.children][1]; const ul = [...tBody.children][0]; ul.appendChild(li); }

const searchDeadlinks = { deadlinkSearch, deadlinkInit };

$.when(mw.loader.using(['mediawiki.util']), $.ready).done(searchDeadlinks.deadlinkInit);

//