MediaWiki:Gadget-EditToolbarButtons.js

// // Contains citation templates to be added to the toolbar. // Source: MediaWiki.org // Credit to RAP for the images. //

// Variables var action = mw.config.get("wgAction");

// We begin by getting the date for use in certain citations. var time = new Date, curday = time.getDate, month = [ "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" ], curmonth = month[time.getMonth], nowyear = time.getYear+1900, nowday = curday.toString, nowmonth = curmonth.toString;

// Now we make the function itself var customizeClassicToolbar = function{ // Start with web cite mw.toolbar.addButton( {		imageFile: 'https://zelda.gamepedia.com/media/zelda.gamepedia.com/9/91/Button_cite_web.png',		speedTip: 'Web Citation',		tagOpen: ' ",		sampleText: ,		imageId: 	} );	// Cite book	mw.toolbar.addButton( {		imageFile: 'https://zelda.gamepedia.com/media/zelda.gamepedia.com/e/ef/Button_cite_book.png',		speedTip: 'Cite Book',		tagOpen: ' ',		sampleText: ,		imageId: 	} );	// Cite guide	mw.toolbar.addButton( {		imageFile: 'https://zelda.gamepedia.com/media/zelda.gamepedia.com/e/ef/Button_cite_book.png',		speedTip: 'Cite Guide',		tagOpen: ' ',		sampleText: ,		imageId: 	} );	// Cite person	mw.toolbar.addButton( {		imageFile: 'https://zelda.gamepedia.com/media/zelda.gamepedia.com/5/53/Button_cite_person.png',		speedTip: 'Cite person',		tagOpen: ' ',		sampleText: ,		imageId: 	} );	// Cite episode	mw.toolbar.addButton( {		imageFile: 'https://zelda.gamepedia.com/media/zelda.gamepedia.com/1/1c/Button_cite_episode.png', speedTip: 'Cite episode', tagOpen: ' ', sampleText: '', imageId: '' } );	// Cite manual	mw.toolbar.addButton( { imageFile: 'https://zelda.gamepedia.com/media/zelda.gamepedia.com/5/5d/Button_cite_manual.png', speedTip: 'Cite manual', tagOpen: ' ', sampleText: '', imageId: '' } );	// Regular cite template	mw.toolbar.addButton( { imageFile: 'https://zelda.gamepedia.com/media/zelda.gamepedia.com/2/20/Button_cite_template.png', speedTip: 'Regular citation', tagOpen: ' ', sampleText: '', imageId: '' } ); };

var customizeWikiEditor = function { $( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {		'section': 'main',		'group': 'insert',		'tools': {			'Cite': {				label: 'Regular Citation',				type: 'button',				icon: 'https://zelda.gamepedia.com/media/zelda.gamepedia.com/2/20/Button_cite_template.png',				'action': {					'type': 'encapsulate',					'options': {						'pre': ' '					}				}			},			'Cite person': {				label: 'Cite person',				type: 'button',				icon: 'https://zelda.gamepedia.com/media/zelda.gamepedia.com/5/53/Button_cite_person.png',				'action': {					'type': 'encapsulate',					'options': {						'pre': ' '					}				}			},			'Cite Book': {				label: 'Cite Book',				type: 'button',				icon: 'https://zelda.gamepedia.com/media/zelda.gamepedia.com/e/ef/Button_cite_book.png',				'action': {					'type': 'encapsulate',					'options': {						'pre': ' '					}				}			},			'Cite Guide': {				label: 'Cite Guide',				type: 'button', icon: 'https://zelda.gamepedia.com/media/zelda.gamepedia.com/e/ef/Button_cite_book.png', 'action': { 'type': 'encapsulate', 'options': { 'pre': ' ' }				}			},			'Cite manual': { label: 'Cite manual', type: 'button', icon: 'https://zelda.gamepedia.com/media/zelda.gamepedia.com/5/5d/Button_cite_manual.png', 'action': { 'type': 'encapsulate', 'options': { 'pre': ' ' }				}			},			'Cite episode': { label: 'Cite episode', type: 'button', icon: 'https://zelda.gamepedia.com/media/zelda.gamepedia.com/1/1c/Button_cite_episode.png', 'action': { 'type': 'encapsulate', 'options': { 'pre': ' ' }				}			},			'Cite web': { label: 'Web Citation', type: 'button', icon: 'https://zelda.gamepedia.com/media/zelda.gamepedia.com/9/91/Button_cite_web.png', 'action': { 'type': 'encapsulate', 'options': { 'pre': ' ' }				}			}		}	} ); }; if( $.inArray(action, ['edit', 'submit']) !== -1 ) {	// mw.loader.using( 'user.options', function { // if ( !mw.user.options.get('usebetatoolbar') ) { // mw.loader.using( 'mediawiki.action.edit', function {				// $( customizeClassicToolbar );			// }); // } else { $( '#wpTextbox1' ).on( 'wikiEditor-toolbar-doneInitialSections', customizeWikiEditor ); // }	// }); }