User:Minesweeper.007/page tools.js

function pagetools { if(document.getElementById('t-whatlinkshere')) { mw.util.addPortletLink('p-cactions', document.getElementById('t-whatlinkshere').firstChild.href,'What links here','ca-whatlinkshere'); if((wgNamespaceNumber==2)||(wgNamespaceNumber==3)) mw.util.addPortletLink('p-cactions', document.getElementById('t-whatlinkshere').firstChild.href.replace(/Whatlinkshere/,'Prefixindex') + '/','Subpages','ca-subpages'); } } addOnloadHook(pagetools);