User:Kylu/editcount.js

From Wikipedia, the free encyclopedia

Note: After saving, you have to bypass your browser's cache to see the changes. Firefox/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 "Edit counts" to the toolbox. */
/* Coded by [[User:Bookofjude]], requested
   by [[User:Kylu]].
   Modified from [[User:Kylu/userlog.js]] by Kylu to work with Edit counts.
 */
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 = '/wiki/User:Interiot/Tool2/code.js?username='+username;
		link.appendChild(document.createTextNode('Edit counts'));
		var li = document.createElement('li');
		li.appendChild(link);
		toolbox.appendChild(li);
	}
});
/* </nowiki></pre> */