Jump to content

User:NQ/anna.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.
var customizeToolbar = function() {
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
	'section': 'main',
	'group': 'insert',
	'tools': {
		'ping': {
			label: 'Ping!', 
			type: 'button',
			icon: '//upload.wikimedia.org/wikipedia/commons/thumb/6/67/BellOn_green.svg/22px-BellOn_green.svg.png',
			action: {
				type: 'encapsulate',
				options: {
				'pre': "{{u|",
                'post': "}}"
				}
			}
		}
	}
} );
};

if ( $.inArray( mw.config.get( 'wgAction' ), [ 'edit', 'submit' ] ) !== -1 ) {
	mw.loader.using( 'user.options' ).then( function () {
		if ( mw.user.options.get( 'usebetatoolbar' ) == 1 ) {
			$.when(
				mw.loader.using( 'ext.wikiEditor' ), $.ready
			).then( customizeToolbar );
		}
	} );
}