User:Gary/tabs.js

function layoutTabs {	// Rename existing tabs var tabsToRename = []; for (var tab = 0; tab < tabsToRename.length; tab++) {		var tabElement = $('#' + tabsToRename[tab][0]); if (tabElement.length) $('a', tabElement).eq(0).contents.get(0).nodeValue = tabsToRename[tab][1]; }	// Add new tabs if (mw.config.get('wgCanonicalNamespace') != 'Special') {		var pagename = encodeURIComponent(mw.config.get('wgPageName')); var username = mw.config.get('wgTitle').split('/')[0]; mw.util.addPortletLink('p-cactions', mw.config.get('wgScriptPath') + '/index.php?title=' + pagename + '&action=purge', 'Purge', 'ca-purge', 'Purge server cache for this page.', 0); }	// Twinkle tab var parameter = ''; if (location.href.search(/\?/) != -1) parameter = '&'; else parameter = '?';

if (/* a diff */ (location.href.search('diff=') != -1) || /* warning a user */ (location.href.search('&vanarticle=') != -1) || /* twinkle is manually enabled */ (location.href.search(/\?tw/) != -1 || location.href.search('&tw') != -1)) importScript('User:AzaToth/twinkle.js'); else if (mw.config.get('wgCanonicalNamespace') != 'Special' || mw.config.get('wgPageName') == 'Special:Contributions') mw.util.addPortletLink('p-cactions', location.href + parameter + 'tw', 'Twinkle', 'ca-twinkle', 'Enable Twinkle'); }

$(layoutTabs);