MediaWiki:WikiLove.js

From Wikimedia Commons, the free media repository
Jump to navigation Jump to search

Note: After saving, you have to bypass your browser's cache to see the changes. Internet Explorer: press Ctrl-F5, Mozilla: hold down Shift while clicking Reload (or press Ctrl-Shift-R), Opera/Konqueror: press F5, Safari: hold down Shift + Alt while clicking Reload, Chrome: hold down Shift while clicking Reload

/**
 * Basic documentation on configuration:
 *   https://www.mediawiki.org/wiki/Extension:WikiLove
 * 
 * This script extends the default configuration in the following way:
 * - Use MediaWiki messages directly where possible.
 * - In headings, it's a bad idea to use those mw-messages because this is confusing.
 * - Delete barnstars that are not required at Commons.
 */
/*global jQuery:false */
/*jshint curly:false */
// jshint valid
//<nowiki>

( function ( $ ) {
'use strict';
  
$.extend(true, $.wikiLoveOptions, {
	types: {
		'barnstar': {
			// some different subtypes
			subtypes: {
				// note that when not using subtypes you should use these subtype options for the top-level type
				'photographers': {
					header: 'A barnstar for you!',
					title: '{{int:wikilove-barnstar-photographers-title}}'
				},
				'designers': {
					header: 'A barnstar for you!',
					title: '{{int:wikilove-barnstar-designers-title}}'
				},
				'copyrightwatch': {
					fields: [ 'message' ],
					option: 'Copyright Watcher Barnstar',
					descr: 'The Copyright Watcher Barnstar may be awarded to those who helped keeping Wikimedia Commons clean from copyright violations.',
					header: 'A barnstar for you!',
					title: 'The Copyright Watcher Barnstar',
					image: 'Control copyright icon.svg'
				},
				'antivandalism': {
					header: 'A barnstar for you!',
					title: '{{int:wikilove-barnstar-antivandalism-title}}'
				},
				'antispam': {
					header: 'A barnstar for you!',
					title: '{{int:wikilove-barnstar-antispam-title}}'
				},
				'admins': {
					header: 'A barnstar for you!',
					title: '{{int:wikilove-barnstar-admins-title}}'
				},
				'original': {
					header: 'A barnstar for you!',
					title: '{{int:wikilove-barnstar-original-title}}'
				},
				'teamwork': {
					header: 'A barnstar for you!',
					title: '{{int:wikilove-barnstar-teamwork-title}}'
				},
				'technical': {
					header: 'A barnstar for you!',
					title: '{{int:wikilove-barnstar-technical-title}}'
				},
				'tireless': {
					fields: [ 'message' ],
					option: 'Tireless Contributor Barnstar',
					descr: 'The Tireless Contributor Barnstar is awarded to especially tireless Wikimedians who contribute an especially large body of work without sacrificing quality.',
					header: 'A barnstar for you!',
					title: 'The Tireless Contributor Barnstar',
					image: 'Tireless Contributor Barnstar Hires.gif'
				},
				'diplomacy': {
					header: 'A barnstar for you!',
					title: '{{int:wikilove-barnstar-diplomacy-title}}'
				},
				'goodhumor': {
					header: 'A barnstar for you!',
					title: '{{int:wikilove-barnstar-goodhumor-title}}'
				},
				'brilliant': {
					header: 'A barnstar for you!',
					title: '{{int:wikilove-barnstar-brilliant-title}}'
				},
				'civility': {
					header: 'A barnstar for you!',
					title: '{{int:wikilove-barnstar-civility-title}}'
				},
				'defender': {
					header: 'A barnstar for you!',
					title: '{{int:wikilove-barnstar-defender-title}}'
				},
				'half': {
					header: 'A barnstar for you!',
					title: '{{int:wikilove-barnstar-half-title}}'
				},
				'minor': {
					header: 'A barnstar for you!',
					title: '{{int:wikilove-barnstar-minor-title}}'
				},
				'kindness': {
					header: 'A barnstar for you!',
					title: '{{int:wikilove-barnstar-kindness-title}}'
				},
				'reallife': {
					header: 'A barnstar for you!',
					title: '{{int:wikilove-barnstar-reallife-title}}'
				},
				'resilient': {
					header: 'A barnstar for you!',
					title: '{{int:wikilove-barnstar-resilient-title}}'
				},
				'rosetta': {
					header: 'A barnstar for you!',
					title: '{{int:wikilove-barnstar-rosetta-title}}'
				},
				'special': {
					header: 'A barnstar for you!',
					title: '{{int:wikilove-barnstar-special-title}}'
				},
				'surreal': {
					header: 'A barnstar for you!',
					title: '{{int:wikilove-barnstar-surreal-title}}'
				}
			}
		},
		'food': {
			subtypes: {
				'baklava': {
					header: 'Some baklava for you!'
				},
				'beer': {
					header: 'A beer for you!'
				},
				'brownie': {
					header: 'A brownie for you!'
				},
				'bubbletea': {
					header: 'Some bubble tea for you!'
				},
				'cheeseburger': {
					header: 'A cheeseburger for you!'
				},
				'cookie': {
					header: 'A cookie for you!'
				},
				'coffee': {
					header: 'A cup of coffee for you!'
				},
				'tea': {
					header: 'A cup of tea for you!'
				},
				'cupcake': {
					header: 'A cupcake for you!'
				},
				'falafel': {
					header: 'Some falafel for you!'
				},
				'pie': {
					header: 'A pie for you!'
				},
				'strawberries': {
					header: 'A bowl of strawberries for you!'
				},
				'stroopwafels': {
					header: 'Some stroopwafels for you!'
				}
			}
		},
		'kitten': {
			header: 'A kitten for you!'
		}
	}
});

var bst = $.wikiLoveOptions.types.barnstar.subtypes,
	del_bst = function (what) {
		if (bst[what]) {
			delete bst[what];
		}
	};

del_bst('writers');
del_bst('editors');
del_bst('copyeditor');
del_bst('citation');

}( jQuery ) );
//</nowiki>