Jump to content

User:FatalError/monobook.js

From Wikipedia, the free encyclopedia
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.
importScript('User:AzaToth/morebits.js');
importScript('User:AzaToth/twinklefluff.js');
importScript('User:AzaToth/twinklewarn.js');
importScript('User:AzaToth/twinklediff.js');
importScript('User:AzaToth/twinklespeedy.js');

TwinkleConfig = {
	watchWarnings : false
};

addOnloadHook (
	function() {
		if ((wgCanonicalNamespace == 'User' || wgCanonicalNamespace == 'User_talk') && wgTitle.indexOf('/') == -1) {
			var li = document.createElement('li');
			li.setAttribute('id', 'ca-contrib');
			var a = document.createElement('a');
			a.setAttribute('title', 'View the user\'s contributions');
			a.setAttribute('href', wgServer + '/wiki/Special:Contributions/' + wgTitle.split('/')[0]);
			var txt = document.createTextNode('Contribs');
			a.appendChild(txt);
			li.appendChild(a);
			var edit = document.getElementById('ca-edit') || document.getElementById('ca-viewsource');
			// Set the padding and stuff so it doesn't look weird
			var editPadding = window.getComputedStyle(edit, null).padding;
			var userPadding = window.getComputedStyle(document.getElementById('ca-nstab-user'), null).padding;
			li.style.padding = editPadding;
			edit.style.padding = userPadding;
			edit.parentNode.insertBefore(li, edit);
		}
	}
);