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.
// <pre>
addOnloadHook(function ()
{
var spans = document.body.getElementsByTagName('span');
var i;
var a;
for(i in spans)
{
if(spans[i].className!=null)
if(spans[i].className.toLowerCase().indexOf("selfreference")!=-1)
{
//found a selfref
spans[i].style.display="none";
a=spans[i].getElementsByTagName("A");
if(a.length==0) break; //can't find a dablink
a=a[a.length-1]; //find last hyperlink in the selfref; this will probably be the dablink itself
mw.util.addPortletLink("p-cactions",a.href,"WP","ca-dablink","WP","");
break; //in case of multiple selfrefs, just do one
}
}
});
// </pre>
//[[Category:Wikipedia scripts]]