Difference between revisions of "MediaWiki:Common.js"
| Line 14: | Line 14: | ||
label: 'Math', | label: 'Math', | ||
type: 'button', | type: 'button', | ||
icon: 'https://latex.codecogs.com/png.image?\dpi{200}&space;\sqrt{x}&space;', | icon: '<img src="https://latex.codecogs.com/png.image?\dpi{200}&space;\sqrt{x}&space;"/>', | ||
//icon: '//upload.wikimedia.org/wikipedia/commons/2/2e/Button_math.png', | //icon: '//upload.wikimedia.org/wikipedia/commons/2/2e/Button_math.png', | ||
action: { | action: { | ||
Revision as of 13:35, 16 February 2022
/* Any JavaScript here will be loaded for all users on every page load. */
// 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 ) {
// Add Math button
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
section: 'advanced',
group: 'format',
tools: {
"math": {
label: 'Math',
type: 'button',
icon: '<img src="https://latex.codecogs.com/png.image?\dpi{200}&space;\sqrt{x}&space;"/>',
//icon: '//upload.wikimedia.org/wikipedia/commons/2/2e/Button_math.png',
action: {
type: 'encapsulate',
options: {
pre: "<math>",
post: "</math>"
}
}
}
}
} );
} );
}