MediaWiki:ToolbarOld.js
Замечание: Возможно, после публикации вам придётся очистить кэш своего браузера, чтобы увидеть изменения.
- Firefox / Safari: Удерживая клавишу Shift, нажмите на панели инструментов Обновить либо нажмите Ctrl+F5 или Ctrl+R (⌘+R на Mac)
- Google Chrome: Нажмите Ctrl+Shift+R (⌘+Shift+R на Mac)
- Internet Explorer / Edge: Удерживая Ctrl, нажмите Обновить либо нажмите Ctrl+F5
- Opera: Нажмите Ctrl+F5.
mw.util.addCSS( '#gadget-toolbar { white-space:nowrap; } \
#gadget-toolbar img { height:20px; background-color:#bce; border:1px outset #bce; margin-right:1px; }' );
function addExtraButtons () {
mw.toolbar.addButtons( [
{
speedTip: 'Перенаправление',
imageFile: wgImg( 'ru/1/1d/Button_redirect_rus.png' ),
tagOpen: '#REDIRECT [[',
sampleText: 'Название целевой страницы',
tagClose: ']]'
},
{
speedTip: 'Категория',
imageFile: wgImg( 'commons/3/3c/Button_cat_ru.png' ),
tagOpen: '[\[Категория:',
sampleText: '',
tagClose: ']]\n'
},
{
speedTip: 'Комментарий',
imageFile: wgImg( 'en/3/34/Button_hide_comment.png' ),
tagOpen: '<!-- ',
sampleText: 'Комментарий',
tagClose: ' -->'
},
{
speedTip: 'Развёрнутая цитата',
imageFile: wgImg( 'en/f/fd/Button_blockquote.png' ),
tagOpen: '<blockquote>\n',
sampleText: 'Развёрнутая цитата одним абзацем',
tagClose: '\n</blockquote>'
},
{
speedTip: 'Вставить таблицу',
imageFile: wgImg( 'en/6/60/Button_insert_table.png' ),
tagOpen: '{| class="wikitable"\n|',
sampleText: '-\n! заголовок 1\n! заголовок 2\n! заголовок 3\n|-\n| строка 1, ячейка 1\n| строка 1, ячейка 2\n| строка 1, ячейка 3\n|-\n| строка 2, ячейка 1\n| строка 2, ячейка 2\n| строка 2, ячейка 3',
tagClose: '\n|}'
},
{
speedTip: 'Сноска',
imageFile: wgImg( 'commons/7/79/Button_reflink.png' ),
tagOpen: '<ref\>',
sampleText: 'Вставьте сюда текст сноски',
tagClose: '</ref>'
}
] );
setTimeout( _thumb, 2000 );
function _thumb() {
$( '#mw-editbutton-image' )
.off( 'click' )
.click( function() {
mw.toolbar.insertTags( '[[Файл:', '|thumb]]', 'Example.jpg' );
return false;
})
}
});
mw.log.deprecate( window, 'addCustomButton', function ( i, t, o, c, s ) {
mw.toolbar.addButton( wgImg( i ), t, o, c, s );
}, 'Use mw.toolbar.addButton instead.' );
mw.loader.using( 'user.options', function () {
// This can be the string "0" if the user disabled the preference ([[bugzilla:52542#c3]])
if ( mw.user.options.get( 'usebetatoolbar' ) != 1 && mw.user.options.get( 'showtoolbar' ) == 1 ) {
$.when(
mw.loader.using( 'mediawiki.toolbar' ),
$.ready
).then( addExtraButtons );
}
} );