MediaWiki:Common.js

Материал из Кафедра ИУ5 МГТУ им. Н.Э.Баумана, студенческое сообщество
Версия от 12:36, 22 января 2019; Bit (обсуждение | вклад)
(разн.) ← Предыдущая версия | Текущая версия (разн.) | Следующая версия → (разн.)
Перейти к навигации Перейти к поиску

Замечание: Возможно, после публикации вам придётся очистить кэш своего браузера, чтобы увидеть изменения.

  • 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.
/* Размещённый здесь 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: " -->"                                }                        }                }        }} );

/* код */
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {        section: 'advanced',        group: 'format',        tools: {                "comment": {                        label: 'Код',                        type: 'button',                        icon: '/images/sys/wikieditor/Button_code.png',                        action: {                                type: 'encapsulate',                                options: {                                        pre: "<code>",                                        post: "</code>"                                }                        }                }        }} );

};

/* 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 );} );}} );}

/* виджет для постов из Телеги */
$(function () {
  $('#telegram-channel-post-widget').html('<script async src="https://telegram.org/js/telegram-widget.js?5" data-telegram-post="iu5bmstu/17" data-width="100%" data-userpic="false"></script>');
}());