User:Alex/monobook.js

From Discovery Wiki
Jump to navigationJump to search

Note: After saving, you may have to bypass your browser's cache to see the changes.

  • Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
  • Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
  • Internet Explorer / Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5
  • Opera: Go to Menu → Settings (Opera → Preferences on a Mac) and then to Privacy & security → Clear browsing data → Cached images and files.
/*
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 = '';
		}
	}
} );