MediaWiki:Common.js: различия между версиями
Перейти к навигации
Перейти к поиску
Claustrum (обсуждение | вклад) (Новая страница: « // // WikiEditor // mw.loader.using('user.options',function(){if (mw.user.options.get('usebetatoolbar')){mw.loader.using('ext.wikiEditor.toolbar',functi…») |
Claustrum (обсуждение | вклад) мНет описания правки |
||
(не показаны 3 промежуточные версии этого же участника) | |||
Строка 1: | Строка 1: | ||
// | |||
// Примечания в цитатах | |||
// | |||
$('blockquote.quote sup.reference a').each (function () { | |||
var match = $(this).text ().match (/\[([^\[\]]*)\s([\d]+)\]/); | |||
if (match !== null) { | |||
$(this).text ('[' + match[2] + ']'); | |||
$(this).parent ().addClass ('localCiteRef'); | |||
} | |||
}); | |||
// | |||
// Подтверждение удаления черновика | |||
// | |||
$('a').live ('click', function () { | |||
var rgx = new RegExp ('(.*)/w/index\\.php\\?title=(.+):Drafts&discard=(.+)'); | |||
if (rgx.test ($(this).attr ('href'))) { | |||
return confirm ('Подтвердите действие.'); | |||
} | |||
}); | |||
// | |||
// Ссылки в новом окне | |||
// | |||
$('.targetblank a').attr ('target', '_blank'); | |||
// | // |
Текущая версия от 20:17, 13 августа 2013
// // Примечания в цитатах // $('blockquote.quote sup.reference a').each (function () { var match = $(this).text ().match (/\[([^\[\]]*)\s([\d]+)\]/); if (match !== null) { $(this).text ('[' + match[2] + ']'); $(this).parent ().addClass ('localCiteRef'); } }); // // Подтверждение удаления черновика // $('a').live ('click', function () { var rgx = new RegExp ('(.*)/w/index\\.php\\?title=(.+):Drafts&discard=(.+)'); if (rgx.test ($(this).attr ('href'))) { return confirm ('Подтвердите действие.'); } }); // // Ссылки в новом окне // $('.targetblank a').attr ('target', '_blank'); // // WikiEditor // mw.loader.using('user.options',function(){if (mw.user.options.get('usebetatoolbar')){mw.loader.using('ext.wikiEditor.toolbar',function(){$(document).ready(function(){ $('#wpTextbox1').wikiEditor ('addToToolbar', { 'sections': { 'templates': { 'type': 'toolbar', 'label': 'Шаблоны' } } }); $('#wpTextbox1').wikiEditor ('addToToolbar', { 'section': 'templates', 'groups': { 'refs': { 'label': 'Источники' }, 'other': { 'label': 'Прочее' } } }); $('#wpTextbox1').wikiEditor ('addToToolbar', { 'section': 'templates', 'group': 'refs', 'tools': { 'quran': { label: 'Коран', type: 'button', icon: '/wiki/images/c/ce/WE-Quran-Icon.png', action: { type: 'encapsulate', options: { pre: '{{Коран|', peri: 'сура|аят', post: '}}' } } }, 'bukhari': { label: 'Сахих аль-Бухари', type: 'button', icon: '/wiki/images/2/21/WE-Bukhari-Icon.png', action: { type: 'encapsulate', options: { pre: '{{Бухари|', peri: 'том|книга|номер', post: '}}' } } }, 'muslim': { label: 'Сахих Муслима', type: 'button', icon: '/wiki/images/a/ac/WE-Muslim-Icon.png', action: { type: 'encapsulate', options: { pre: '{{Муслим|', peri: 'книга|номер', post: '}}' } } }, 'tabari': { label: 'Ат-Табари', type: 'button', icon: '/wiki/images/6/67/WE-Tabari-Icon.png', action: { type: 'encapsulate', options: { pre: '{{Табари|', peri: 'том|страница', post: '}}' } } }, 'abudawud': { label: 'Абу Дауд', type: 'button', icon: '/wiki/images/5/52/WE-AbuDawud-Icon.png', action: { type: 'encapsulate', options: { pre: '{{АбуДауд|', peri: 'книга|номер', post: '}}' } } }, 'muwatta': { label: 'Аль-Муватта', type: 'button', icon: '/wiki/images/5/5a/WE-Muwatta-Icon.png', action: { type: 'encapsulate', options: { pre: '{{Муватта|', peri: 'книга|секция|номер|', post: '}}' } } } } }); $('#wpTextbox1').wikiEditor ('addToToolbar', { 'section': 'templates', 'group': 'other', 'tools': { 'quote': { label: 'Цитата', type: 'button', icon: '/wiki/images/f/fa/WE-Quote-Icon.png', action: { type: 'encapsulate', options: { pre: '{{Цитата|', peri: 'текст цитаты|источник цитаты', post: '}}' } } } } }); });});}});