MediaWiki:Common.js

From TenthFleet
Revision as of 00:31, 29 July 2026 by MDGarcia (talk | contribs) (Add Contributor's guide button to the WikiEditor toolbar (opens guide in a new tab))
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Note: After publishing, you may have to bypass your browser's cache to see the changes.

  • Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
  • Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
  • Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5.
/* Add a "Contributor's guide" button to the WikiEditor toolbar (top-right utility group). */
mw.loader.using( [ 'ext.wikiEditor', 'mediawiki.util' ] ).then( function () {
	mw.hook( 'wikiEditor.toolbarReady' ).add( function ( $textarea ) {
		$textarea.wikiEditor( 'addToToolbar', {
			section: 'secondary',
			group: 'default',
			tools: {
				contributorsguide: {
					label: "Contributor's guide",
					type: 'button',
					oouiIcon: 'help',
					action: {
						type: 'callback',
						execute: function () {
							window.open(
								mw.util.getUrl( "TenthFleet:Contributor's guide" ),
								'_blank'
							);
						}
					}
				}
			}
		} );
	} );
} );