MediaWiki:Common.js: различия между версиями
Перейти к навигации
Перейти к поиску
Bit (обсуждение | вклад) Нет описания правки |
Bit (обсуждение | вклад) Нет описания правки |
||
Строка 2: | Строка 2: | ||
var customizeToolbar = function() { | var customizeToolbar = function() { | ||
/* удаление секции вставки кучи символов */ | /* удаление секции вставки кучи символов */ | ||
Строка 9: | Строка 8: | ||
$( '#wpTextbox1' ).wikiEditor( 'removeFromToolbar', {'section': 'help'}); | $( '#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: { "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: 'Формула', type: 'button', icon: '/images/sys/wikieditor/Button_math.png', action: { type: 'encapsulate', options: { pre: "{{Формула|f=", post: "}}" } } } }} ); | $( '#wpTextbox1' ).wikiEditor( 'addToToolbar', { section: 'advanced', group: 'format', tools: { "math": { label: 'Формула', type: 'button', icon: '/images/sys/wikieditor/Button_math.png', action: { type: 'encapsulate', options: { pre: "{{Формула|f=", post: "}}" } } } }} ); | ||
/* комментарий*/ | |||
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', { section: 'advanced', group: 'format', tools: { "comment": { label: 'Комментарий', type: 'button', icon: '/images/sys/wikieditor/Btn_toolbar_commentaire.png', action: { type: 'encapsulate', options: { pre: "<!-- ", post: " -->" | $( '#wpTextbox1' ).wikiEditor( 'addToToolbar', { section: 'advanced', group: 'format', tools: { "comment": { label: 'Комментарий', type: 'button', icon: '/images/sys/wikieditor/Btn_toolbar_commentaire.png', action: { type: 'encapsulate', options: { pre: "<!-- ", post: " -->" | ||
Версия от 19:33, 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: 'Формула', type: 'button', icon: '/images/sys/wikieditor/Button_math.png', action: { type: 'encapsulate', options: { pre: "{{Формула|f=", post: "}}" } } } }} );
/* комментарий*/
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', { section: 'advanced', group: 'format', tools: { "comment": { label: 'Комментарий', type: 'button', icon: '/images/sys/wikieditor/Btn_toolbar_commentaire.png', action: { type: 'encapsulate', options: { pre: "<!-- ", 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 );} );}} );}