Перейти к содержанию

MediaWiki:Common.js: различия между версиями

нет описания правки
Нет описания правки
Нет описания правки
Строка 1: Строка 1:
/* Размещённый здесь код JavaScript будет загружаться пользователям при обращении к каждой странице */
/* Размещённый здесь код JavaScript будет загружаться пользователям при обращении к каждой странице */
function customizeToolbar() {
/* Check if we are in edit mode and the required modules are available and then customize the toolbar */
    $('#left-navigation').wikiEditor('addToToolbar', {
if ( [ 'edit', 'submit' ].indexOf( mw.config.get( 'wgAction' ) ) !== -1 ) {
        'section': 'main',
// Add a hook handler.
        'group': 'format',
mw.hook( 'wikiEditor.toolbarReady' ).add( function ( $textarea ) {
        'tools': {
// Configure a new toolbar entry on the given $textarea jQuery object.
             'guillemets': {
$textarea.wikiEditor( 'addToToolbar', {
section: main,
group: format,
tools: {
             guillemets: {
                 label: 'Anførselstegn',
                 label: 'Anførselstegn',
                 type: 'button',
                 type: 'button',
Строка 17: Строка 21:
                 }
                 }
             }
             }
        }
}
    });
} );
}
} );
/* Check if we are in edit mode and the required modules are available and then customize the toolbar */
if ($.inArray(mw.config.get('wgAction'), ['edit', 'submit']) !== -1 ) {
    mw.loader.using( 'user.options', function () {
        if ( mw.user.options.get('usebetatoolbar') ) {
            mw.loader.using( 'ext.wikiEditor.toolbar', function () {
                $(customizeToolbar);
            } );
        }
    });
}
}