Изменения

Перейти к навигации Перейти к поиску
Новая страница: «/* Размещённый здесь код JavaScript будет загружаться пользователям при обращении к каждой ст...»
/* Размещённый здесь код JavaScript будет загружаться пользователям при обращении к каждой странице */
/** -pm- Изменяем панель инструментов в редакторе WikiEditor **/
var customizeToolbar = function () {
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
section: 'advanced',
group: 'format',
tools: {
"underline": {
label: 'Подчёркивание',
type: 'button',
icon: '//upload.wikimedia.org/wikipedia/commons/f/fd/Button_underline.png',
action: {
type: 'encapsulate',
options: {
pre: "<u>",
post: "</u>"
}
}
},
"double_underline": {
label: 'Двойное подчёркивание',
type: 'button',
icon: '//upload.wikimedia.org/wikipedia/commons/4/45/Button_double.png',
action: {
type: 'encapsulate',
options: {
pre: "{{Стиль С-Двойное подчёркивание|",
post: "}}"
}
}
},
"justify-center": {
label: 'Выравнивание по центру',
type: 'button',
icon: '//upload.wikimedia.org/wikipedia/commons/5/5f/Button_center.png',
action: {
type: 'encapsulate',
options: {
pre: "<center>",
post: "</center>"
}
}
},
"justify-right": {
label: 'Выравнивание справа',
type: 'button',
icon: '//upload.wikimedia.org/wikipedia/commons/a/a5/Button_align_right.png',
action: {
type: 'encapsulate',
options: {
pre: "{{Стиль А-Текст справа|",
post: "}}"
}
}
},
"no_indent": {
label: 'Первая строка без отступа',
type: 'button',
icon: '//upload.wikimedia.org/wikipedia/commons/2/29/Button_justify.png',
action: {
type: 'encapsulate',
options: {
pre: "{{Стиль А-Текст без отступа|",
post: "}}"
}
}
},
"columns": {
label: 'Разбить текст на колонки',
type: 'button',
icon: '//upload.wikimedia.org/wikipedia/commons/0/04/Button_multicol.png',
action: {
type: 'encapsulate',
options: {
pre: "{{Колонки начинаются||ширина=|размер=}}",
post: "{{Колонки завершаются}}"
}
}
},
"category": {
label: 'Категория',
type: 'button',
icon: '//upload.wikimedia.org/wikipedia/commons/c/c4/Toolbar_category.png',
action: {
type: 'encapsulate',
options: {
pre: "[[Категория: ",
post: "]]"
}
}
},
"nbsp": {
label: 'Неразрывный пробел',
type: 'button',
icon: '//upload.wikimedia.org/wikipedia/commons/6/64/Button_nbsp_bold.png',
action: {
type: 'encapsulate',
options: {
pre: "&nbsp;",
post: ""
}
}
},
"dash": {
label: 'Тире',
type: 'button',
icon: '//upload.wikimedia.org/wikipedia/commons/c/cd/Button_mdash.png',
action: {
type: 'encapsulate',
options: {
pre: "–",
post: ""
}
}
},
"vertical_space": {
label: 'Вертикальный отступ перед абзацем, по умолчанию 1em',
type: 'button',
icon: '//upload.wikimedia.org/wikipedia/commons/7/71/TableCell.png',
action: {
type: 'encapsulate',
options: {
pre: "{{Вертикальный отступ|",
post: "}}"
}
}
},
"small_capitals": {
label: 'Капитель (маленькие заглавные буквы)',
type: 'button',
icon: '//upload.wikimedia.org/wikipedia/commons/8/89/Button_bigger.png',
action: {
type: 'encapsulate',
options: {
pre: "{{Стиль С-Капитель|",
post: "}}"
}
}
},
"quot_main": {
label: 'Кавычки основные',
type: 'button',
icon: '//upload.wikimedia.org/wikipedia/commons/a/ac/Norwegian_quote_sign.png',
action: {
type: 'encapsulate',
options: {
pre: "«",
post: "»"
}
}
}
}
} );

$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
section: 'main',
groups: {
list: {
tools: {
templatesA: {
label: 'Шаблоны',
type: 'select',
list: {
'Podpis': {label: 'Подпись', action: {type: 'encapsulate',
options: {pre: '{{Подпись|автор=', post: '|труд=}}'} } },
'Propuscheno': {label: 'Пропущено', action: {type: 'encapsulate',
options: {pre: '{{Пропущено}}'} } }
}
},
}
}
}
} );
};

/* 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' ).then( function () {
// This can be the string "0" if the user disabled the preference ([[phab:T54542#555387]])
if ( mw.user.options.get( 'usebetatoolbar' ) == 1 ) {
$.when(
mw.loader.using( 'ext.wikiEditor' ), $.ready
).then( customizeToolbar );
}
} );
}

Навигация