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

Материал из Кафедра ИУ5 МГТУ им. Н.Э.Баумана, студенческое сообщество
Перейти к навигации Перейти к поиску
Нет описания правки
Нет описания правки
 
(не показано 15 промежуточных версий этого же участника)
Строка 1: Строка 1:
/* Размещённый здесь JavaScript код будет загружаться всем пользователям при обращении к каждой странице */
/* Размещённый здесь JavaScript код будет загружаться всем пользователям при обращении к каждой странице */


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


/* 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 );} );}} );}
/* зачёркнутый */
$('#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>');
}());

Текущая версия от 12:36, 22 января 2019

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