MediaWiki:Common.js: различия между версиями
User (обсуждение | вклад) Нет описания правки |
User (обсуждение | вклад) Нет описания правки |
||
| Строка 1: | Строка 1: | ||
/* Размещённый здесь код JavaScript будет загружаться пользователям при обращении к каждой странице */ | /* Размещённый здесь код JavaScript будет загружаться пользователям при обращении к каждой странице */ | ||
/* Check if we are in edit mode and the required modules are available and then customize the toolbar */ | |||
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: main, | |||
group: format, | |||
tools: { | |||
guillemets: { | |||
label: 'Anførselstegn', | label: 'Anførselstegn', | ||
type: 'button', | type: 'button', | ||
| Строка 17: | Строка 21: | ||
} | } | ||
} | } | ||
} | |||
} ); | |||
} ); | |||
} | } | ||
Версия от 11:29, 13 мая 2024
/* Размещённый здесь код JavaScript будет загружаться пользователям при обращении к каждой странице */
/* Check if we are in edit mode and the required modules are available and then customize the toolbar */
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: main,
group: format,
tools: {
guillemets: {
label: 'Anførselstegn',
type: 'button',
icon: '//upload.wikimedia.org/wikipedia/commons/b/b5/Wikify_button.svg',
action: {
type: 'encapsulate',
options: {
pre: "«",
post: "»"
}
}
}
}
} );
} );
}