Jump to content

User:Splarka/stripredlinks.js

From Wikipedia, the free encyclopedia
Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.
addOnloadHook(function() {
  mw.util.addPortletLink('p-tb','javascript:stripredlinks()','Remove red links','t-unred','Remove all red <li> links on this page');
})
 
function stripredlinks() {
  var lis = document.getElementById('bodyContent').getElementsByTagName('li');
  for(var i=lis.length-1;i>-1;i--) {
    var as = lis[i].getElementsByTagName('a');
    for(var j=as.length-1;j>-1;j--) {
      if(as[j].className.indexOf('new')!=-1) lis[i].parentNode.removeChild(lis[i])
    }
  }
}