User:Kylu/userlog.js
From Wikipedia, the free encyclopedia
Note: After saving, you have to bypass your browser's cache to see the changes. Mozilla/Safari: hold down Shift while clicking Reload (or press Ctrl-Shift-R), Internet Explorer: press Ctrl-F5, Opera/Konqueror: press F5.
/* <pre><nowiki> */ /* Adds "User logs" to the toolbox. */ /* Coded by [[User:Bookofjude]], requested by [[User:Kylu]]. */ addOnloadHook(function () { if (document.getElementById('t-contributions')) { z=document.getElementById("content").childNodes; for (var n=0;n<z.length;n++) { if (z[n].className=="firstHeading") var username = z[n].textContent.replace(new RegExp('User(?:[ _]talk)?:([^/]*)', 'g'), '$1'); }; var toolbox = document.getElementById('p-tb').getElementsByTagName('ul')[0]; var link = document.createElement('a'); link.href = '/w/index.php?title=Special:Log&user='+username; link.appendChild(document.createTextNode('User logs')); var li = document.createElement('li'); li.appendChild(link); toolbox.appendChild(li); } }); /* </nowiki></pre> */