User:Lupin/redlinks.js

// red links //////////////////////////////////////////////////

function stopRedlinksEditing{ var len=document.links.length; for(var i=0; i<len; ++i) { var l=document.links[i]; if (l.className=='new') { l.href=l.href.replace('&action=edit','') .replace('Special:Upload&wpDestFile=', 'Image:'); }   } } addOnloadHook(stopRedlinksEditing);

function listRedLinks { var len=document.links.length; var output=document.createElement('div'); output.innerHTML=' Red links '; var gotSome=false; var j=0; for (var i=0; i<len; ++i) { var lk=document.links[i]; if (lk.className=='new') { j++; gotSome=true; var l=lk.cloneNode(true); lk.name=lk.name || 'redlink'+j; l.href='#' + lk.name; output.appendChild(l); output.appendChild(document.createElement('br')); }       }        if (gotSome){ output.appendChild(document.createElement('hr')); var h1=document.getElementsByTagName('h1')[0]; h1.parentNode.insertBefore(output, h1.nextSibling); } } addOnloadHook(function{addToolboxLink('javascript:listRedLinks', 'List red links');});