MediaWiki:Gadget-extra-toolbar-buttons-core.js

// /*global mw */ /*jshint strict: false, browser: true, jquery: true */ /** * Extra toolbar options *  *  Description: Adds extra buttons to the old (non-enhanced) editing toolbar. *  *  Maintainers: User:MarkS, User:Voice of All, User:R. Koot */

function addExtraButtons { mw.toolbar.addButtons(	{		imageId: 'button-redirect',		imageFile: '//upload.wikimedia.org/wikipedia/en/c/c8/Button_redirect.png',		speedTip: 'Redirect',		tagOpen: '#REDIRECT',		tagClose: ,		sampleText: 'Target page name'	},	{		imageId: 'button-strike',		imageFile: '//upload.wikimedia.org/wikipedia/en/c/c9/Button_strike.png',		speedTip: 'Strike',		tagOpen: ' ',		tagClose: ' ',		sampleText: 'Strike-through text'	},	{		imageId: 'button-enter',		imageFile: '//upload.wikimedia.org/wikipedia/en/1/13/Button_enter.png',		speedTip: 'Line break',		tagOpen: ' ',		tagClose: ,		sampleText: ''	},	{		imageId: 'button-subscript',		imageFile: '//upload.wikimedia.org/wikipedia/en/7/70/Button_lower_letter.png',		speedTip: 'Subscript',		tagOpen: '$',		tagClose: '$',		sampleText: 'Subscript text'	},	{		imageId: 'button-superscript',		imageFile: '//upload.wikimedia.org/wikipedia/en/8/80/Button_upper_letter.png',		speedTip: 'Superscript', tagOpen: '$',		tagClose: '$', sampleText: 'Superscript text' },	{		imageId: 'button-small', imageFile: '//upload.wikimedia.org/wikipedia/en/5/58/Button_small.png', speedTip: 'Smaller', tagOpen: '', tagClose: '', sampleText: 'Smaller text' },	{		imageId: 'mw-customeditbutton-templatelarger', imageFile: '//upload.wikimedia.org/wikipedia/commons/5/56/Button_big.png', speedTip: 'Larger', tagOpen: '', tagClose: '', sampleText: '' },	{		imageId: 'mw-customeditbutton-templatesmallcaps', imageFile: '//upload.wikimedia.org/wikipedia/commons/4/4e/Button_romain.png', speedTip: 'sc ', tagOpen: '', sampleText: '' },	{		imageId: 'mw-customeditbutton-templatecenter', imageFile: '//upload.wikimedia.org/wikipedia/commons/5/5f/Button_center.png', speedTip: 'Centre text', tagOpen: '', tagClose: '', sampleText: '' },	{		imageId: 'mw-customeditbutton-linkauthor', imageFile: '//upload.wikimedia.org/wikipedia/commons/8/83/Button_biocitas.png', speedTip: 'Author link', tagOpen: 'Author:',		tagClose: '', sampleText: '' },	{		imageId: 'button-insert-reflink', imageFile: '//upload.wikimedia.org/wikipedia/commons/7/79/Button_reflink.png', speedTip: 'Insert a reference', tagOpen: ' ', sampleText: 'Insert footnote text here' },	{		imageId: 'mw-customeditbutton-templatehwe', imageFile: '//upload.wikimedia.org/wikipedia/commons/0/07/Hyphenated_word_end.svg', speedTip: 'hwe ', tagOpen: '', sampleText: '' },	{		imageId: 'mw-customeditbutton-substitution', imageFile: '//upload.wikimedia.org/wikipedia/commons/2/20/Button_subst.png', speedTip: 's: ', tagOpen: '', sampleText: '' },	{		imageId: 'mw-customeditbutton-linkwikipedia', imageFile: '//upload.wikimedia.org/wikipedia/commons/7/7f/Button_link_to_Wikipedia.png', speedTip: 'Wikipedia link', tagOpen: 'w:',		tagClose: '', sampleText: '' },	{		imageId: 'mw-customeditbutton-textforcesentencecase', imageFile: '//upload.wikimedia.org/wikipedia/commons/1/12/Button_case.png', speedTip: 'force sentence case', tagOpen: '', sampleText: '' },	{		imageId: 'mw-customeditbutton-pagesdjvu', imageFile: '//upload.wikimedia.org/wikipedia/commons/7/74/Documents_icon.svg', speedTip: 'pg ', tagOpen: '', sampleText: '' },		{		imageId: 'mw-customeditbutton-linkitalics', imageFile: '//upload.wikimedia.org/wikipedia/commons/4/4d/Farm-Fresh_book_link.png', speedTip: 'bk ', tagOpen: '\'\,		tagClose: '\'\, sampleText: '' },	{		imageId: 'mw-customeditbutton-taginsertreference', imageFile: '//upload.wikimedia.org/wikipedia/commons/7/79/Button_reflink.png', speedTip: 'ref', tagOpen: '', sampleText: '' },	{		imageId: 'mw-customeditbutton-sectionbegin', imageFile: '//upload.wikimedia.org/wikipedia/commons/0/06/Tag_green.png', speedTip: 'section begin', tagOpen: '', sampleText: '' },	{		imageId: 'mw-customeditbutton-sectionend', imageFile: '//upload.wikimedia.org/wikipedia/commons/d/dd/Tag_red.png', speedTip: 'section end', tagOpen: '', sampleText: '' },	{		imageId: 'mw-customeditbutton-tagtemplateblockcenterpoem', imageFile: '//upload.wikimedia.org/wikipedia/commons/4/4f/Button_verse.png', speedTip: 'spm', tagOpen: '', sampleText: '' },	{		imageId: 'mw-customeditbutton-EB9', imageFile: '//upload.wikimedia.org/wikipedia/commons/d/db/Button_with_wikinumber_character.png', speedTip: 'EB9 ', tagOpen: '', sampleText: '' }

); }

mw.loader.using( 'user.options', function {	// This can be the string "0" if the user disabled the preference (52542)	if ( mw.user.options.get( 'usebetatoolbar' ) != 1 && mw.user.options.get( 'gadget-legacyToolbar' ) == 1 ) {		mw.hook("mw.toolbar").add( addExtraButtons );	} } ); //