YellowWarningTriangle.png This wiki is closed in favour of the new wiki. Information shown is likely to be very out of date.

Difference between revisions of "User:Alex/monobook.js"

From Discovery Wiki
Jump to navigationJump to search
(Was doing some admin stuff on mediawiki.org and came across two useful gadgets. Applying them here.)
 
m (moved User:Alex/common.js to User:Alex/monobook.js: Maybe this will fix it)
 
(No difference)

Latest revision as of 14:55, 26 February 2012

/*
For more info, visit:
https://www.mediawiki.org/wiki/Extension:Gadgets
https://www.mediawiki.org/w/index.php?title=Special:Gadgets
*/

/*
Adds a tab to block users from their user and user talk pages
Source: https://www.mediawiki.org/wiki/MediaWiki:Gadget-blocktab.js
Access date: 25/2/12
*/
jQuery( document ).ready( function() {
    var ns = mw.config.get( 'wgNamespaceNumber' );
	if ( ns !== 2 && ns !== 3 ) {
		return;  // restrict to User and User talk
	}
 
        var localtitles = {
			en: 'Block',
			pl: 'Zablokuj'
	};
 
        if( localtitles[wgUserLanguage] ) {
			TabTitle = localtitles[wgUserLanguage];
        }
 
	var title = mw.config.get( 'wgTitle' );
 
	// @todo: Use mw.msg when Gadgets 2.0 is out and messages can be loaded
	mw.util.addPortletLink(
		'p-cactions',
		mw.util.wikiGetlink( 'Special:Block/' + title ),
		TabTitle, 't-blockip', TabTitle + ' "' + title + '"'
	);
 
});

/*
Clean Delete Reasons: This script will remove the automatic deletion reasons to keep the delete logs cleaner. It will not affect the reason that come from the URL.
Source: https://www.mediawiki.org/wiki/MediaWiki:Gadget-CleanDeleteReasons.js
Access date: 25/2/12
*/
// Written and maintained by https://www.mediawiki.org/wiki/User:Mike.lifeguard
jQuery( document ).ready( function() {
	if ( wgAction == 'delete' ) {
		var wpReason = document.getElementById( 'wpReason' );
		if ( !wpReason ) {
			return;
		}
		var regexp = /(content was|page was empty|content before blanking was)/i;
		if ( regexp.test( wpReason.value ) ) {
			wpReason.value = '';
		}
	}
} );