Difference between revisions of "MediaWiki:Common.js"
From Fintech Lab Wiki
(Created page with "→Any JavaScript here will be loaded for all users on every page load.: // WikiEditor Toolbar customization. // refs https://www.mediawiki.org/wiki/Extension:WikiEditor/To...") |
(No difference)
|
Latest revision as of 09:45, 20 May 2022
/* Any JavaScript here will be loaded for all users on every page load. */ // WikiEditor Toolbar customization. // refs https://www.mediawiki.org/wiki/Extension:WikiEditor/Toolbar_customization#Basic_setup // Check if we're editing a page. if ( [ 'edit', 'submit' ].indexOf( mw.config.get( 'wgAction' ) ) !== -1 ) { // Add a hook handler. mw.hook( 'wikiEditor.toolbarReady' ).add( function ( $textarea ) { // Configure a new toolbar entry on the given $textarea jQuery object. $textarea.wikiEditor( 'addToToolbar', { section: 'advanced', group: 'format', tools: { math: { label: 'Math', type: 'button', oouiIcon: 'mathematics', action: { type: 'encapsulate', options: { pre: '<math>', post: '</math>' } } } } } ); $textarea.wikiEditor( 'addToToolbar', { section: 'advanced', group: 'format', tools: { "strikethrough": { label: 'Strike', type: 'button', oouiIcon: 'strikethrough', action: { type: 'encapsulate', options: { pre: "<s>", post: "</s>" } } } } } ); } ); }