This file was selected for display on the Main Page as the media of the day. Click here for more information.

User:Roy17/common.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.
//<nowiki>

//catALot///////////////////////////////////////
////////// Cat-a-lot user preferences //////////
window.catALotPrefs = {"disambig_category":"Disambiguation","redir_category":"Category redirects","watchlist":"preferences","minor":true,"editpages":true,"docleanup":true,"subcatcount":50,"uncat":true,"button":true};
////////////////////////////////////catALotEnd//
//</nowiki>

importScript('User:Magnus Manske/sdc_tool.js');
window.HotCatAutoRemoveCheckCat = true;


var customizeToolbar = function () {
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
	'section': 'main',
	'groups': {
		'mine': {
			'label': 'mine'
		}
	}
} );
	
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
	section: 'main',
	group: 'mine',
	tools: {
		"LRW": {
			label: 'LRW',
			type: 'button',
			icon: '//upload.wikimedia.org/wikipedia/commons/3/34/11_7_3_(Swedish_road_sign).svg',
			action: {
				type: 'encapsulate',
				options: {
					pre: "{{subst"+":lrw|site=",
					post: "}}",
					ownline: true
				}
			}
		},
		"MOTD": {
			label: 'MOTD',
			type: 'button',
			icon: '//upload.wikimedia.org/wikipedia/commons/f/f9/Flèche_à_droite.svg',
			action: {
				type: 'encapsulate',
				options: {
					pre: "=={{Assessment}}==",
					post: "{{Media of the day|year={{subst"+":CURRENTYEAR}}|month=0|day=}}",
					ownline: true
				}
			}
		}
	}
} );
};

/* Check if view is in edit mode and that the required modules are available. Then, customize the toolbar … */
if ( [ 'edit', 'submit' ].indexOf( mw.config.get( 'wgAction' ) ) !== -1 ) {
	mw.loader.using( 'user.options' ).then( function () {
		// This can be the string "0" if the user disabled the preference ([[phab:T54542#555387]])
		if ( mw.user.options.get( 'usebetatoolbar' ) == 1 ) {
			$.when(
				mw.loader.using( 'ext.wikiEditor' ), $.ready
			).then( customizeToolbar );
		}
	} );
}