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

Материал из Кафедра ИУ5 МГТУ им. Н.Э.Баумана, студенческое сообщество
Перейти к навигации Перейти к поиску
Нет описания правки
Нет описания правки
Строка 10: Строка 10:




$('#wpTextbox1').wikiEditor('addToToolbar', {        section: 'advanced',        group: 'format',        tools: {                "strikethrough": {                        label: 'Strike',                        type: 'button',                        icon: '//upload.wikimedia.org/wikipedia/commons/3/30/Btn_toolbar_rayer.png',                        action: {                                type: 'encapsulate',                                options: {                                        pre: "<s>",                                        post: "</s>"                                }                        }                }        }});
$('#wpTextbox1').wikiEditor('addToToolbar', {        section: 'advanced',        group: 'format',        tools: {                "strikethrough": {                        label: 'Зачёркнутый',                        type: 'button',                        icon: '//images/sys/wikieditor/Btn_toolbar_rayer.png',                        action: {                                type: 'encapsulate',                                options: {                                        pre: "<s>",                                        post: "</s>"                                }                        }                }        }});
 
 
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {        section: 'advanced',        group: 'format',        tools: {                "math": {                        label: 'Math',                        type: 'button',                        icon: '//images/sys/wikieditor/Button_math.png',                        action: {                                type: 'encapsulate',                                options: {                                        pre: "{{Формула|f=",                                        post: "}}"                                }                        }                }        }} );


};
};

Версия от 19:13, 16 ноября 2012

/* Размещённый здесь JavaScript код будет загружаться всем пользователям при обращении к каждой странице */

var customizeToolbar = function() {


/* удаление секции вставки кучи символов */
$( '#wpTextbox1' ).wikiEditor( 'removeFromToolbar', {'section': 'characters'});
/* удаление секции со справкой */
$( '#wpTextbox1' ).wikiEditor( 'removeFromToolbar', {'section': 'help'});


$('#wpTextbox1').wikiEditor('addToToolbar', {        section: 'advanced',        group: 'format',        tools: {                "strikethrough": {                        label: 'Зачёркнутый',                        type: 'button',                        icon: '//images/sys/wikieditor/Btn_toolbar_rayer.png',                        action: {                                type: 'encapsulate',                                options: {                                        pre: "<s>",                                        post: "</s>"                                }                        }                }        }});


$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {        section: 'advanced',        group: 'format',        tools: {                "math": {                        label: 'Math',                        type: 'button',                        icon: '//images/sys/wikieditor/Button_math.png',                        action: {                                type: 'encapsulate',                                options: {                                        pre: "{{Формула|f=",                                        post: "}}"                                }                        }                }        }} );

};

/* Check if view is in edit mode and that the required modules are available. 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 () {$(document).ready( customizeToolbar );} );}} );}