User:Jack Phoenix/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.
// *****************************************************************
// Purge tab on every non-special page
// By Splarka
// *****************************************************************
if ( mw.config.get( 'wgNamespaceNumber' ) > -1 ) {
	$( function() {
		mw.util.addPortletLink(
			'p-cactions',
			mw.config.get( 'wgServer' ) + mw.config.get( 'wgScript' ) +
				'?title=' + encodeURIComponent( mw.config.get( 'wgPageName' ) ) +
				'&action=purge',
			'purge'
		);
	} );
}

// *****************************************************************
// &bot=1 on contribs pages
// *****************************************************************
function hideRollback() {
	var botlink = document.location.href;
	if ( botlink.indexOf( '?' ) == -1 ) {
		botlink += '?bot=1';
	} else {
		botlink += '&bot=1';
	}
	mw.util.addPortletLink( 'p-cactions', botlink, '&bot=1', 'ca-bot' );
}
if ( mw.config.get( 'wgCanonicalSpecialPageName' ) == 'Contributions' ) {
	$( hideRollback );
}