Участник:KPu3uC B Poccuu/common.js
Перейти к навигации
Перейти к поиску
Страница персонального оформления. JS-код ниже относится ко всем темам оформления (включая мобильную версию) Википедии. CSS-файл: Участник:KPu3uC B Poccuu/common.css.
После сохранения очистите кэш браузера.
После сохранения очистите кэш браузера.
//<nowiki>
/* global $, mw, pathoschild */
rcp_enabled=false;
rcp_num_pages=50;
rcp_refresh=360;
rcp_str_box_title_updating="Свежие правки";
navFrameCollapseCaption='[ скрыть ]';
popupDelay=1;
popupPreviewKillTemplates=false;
highlightMessagesAfterLastVisit=true;
messagesHighlightTimeout=5;
HighlightredirectsAll=true;
/**
* TemplateScript adds configurable templates and scripts to the sidebar, and adds an example regex editor.
* @see https://meta.wikimedia.org/wiki/TemplateScript
* </nowiki>@update-token [[File:Pathoschild/templatescript.js]]<nowiki>
*/
mw.loader.load('//tools-static.wmflabs.org/meta/scripts/i18n/ru.js');
$.ajax('//tools-static.wmflabs.org/meta/scripts/pathoschild.templatescript.js',{dataType:'script',cache:true}).then(function()
{
pathoschild.TemplateScript.add([
{
name: 'Оформление',
script: function RegexCleanup(editor)
{
var replacer=function(text)
{
return text
.replace(/(\.\.\.|…)/ig, '…')
.replace(/\{\{u\|([^][<>"\s]+)\}\}/ig, '[[User:$1|$1]]')
.replace(/\[\{\{SERVER}}\{\{localurl:/ig, '[{{fullurl:')
.replace(/\[(?:https?:)?\/\/ru\.wikipedia\.org\/wiki\/(Category|Image|File|Категория|Файл|Изображение)\s*:\s*([^][<>"\s]+)[\s]+([^]]+)\]/ig, '[[:$1:$2|$3]]')
.replace(/\[?(?:https?:)?\/\/ru\.wikipedia\.org\/wiki\/(Category|Image|File|Категория|Файл|Изображение)\s*:\s*([^][<>"\s]+)(\s*)\]?/ig, '[[:$1:$2]]$3')
.replace(/\[(?:https?:)?\/\/ru\.wikipedia\.org\/wiki\/([^][<>"\s]+)\s+([^]]+)\]/ig, '[[$1|$2]]')
.replace(/\[?(?:https?:)?\/\/ru\.wikipedia\.org\/wiki\/([^][<>"\s]+)([\s]*)\]?/, '[[$1]]$2')
.replace(/\[(?:https?:)?\/\/(\S{1,6})\.wikipedia\.org\/wiki\/([^][<>"\s]+)\s+([^]]+)\]/ig, '[[:$1:$2|$3]]')
.replace(/\[?(?:https?:)?\/\/(\S{1,6})\.wikipedia\.org\/wiki\/([^][<>"\s]+)(\s*)\]?/ig, '[[:$1:$2]]$3')
.replace(/\[(?:https?:)?\/\/([a-z0-9\-]{1,6})\.(?:(wikt)ionary|wiki(n)ews|wiki(b)ooks|wiki(q)uote|wiki(s)ource|wiki(v)ersity)\.(?:com|net|org)\/wiki\/([^][<>{|}\s"]*)\s+([^\n\]]+)\]/ig, '[[$2$3$4$5$6$7:$1:$8|$9]]')
.replace(/\[?(?:https?:)?\/\/([a-z0-9\-]{1,6})\.(?:(wikt)ionary|wiki(n)ews|wiki(b)ooks|wiki(q)uote|wiki(s)ource|wiki(v)ersity)\.(?:com|net|org)\/wiki\/([^][<>"\s]+)(\s*)\]?/ig, '[[$2$3$4$5$6$7:$1:$8]]$9')
.replace(/\[(?:https?:)?\/\/(?:(m)eta|(commons)|(incubator)|(quality)|(species)|(strategy))\.wikimedia\.(?:com|net|org)\/wiki\/([^][<>{|}\s"]*)\s+([^\n\]]+)\]/ig, '[[$1$2$3$4$5$6:$7|$8]]')
.replace(/\[?(?:https?:)?\/\/(?:(m)eta|(commons)|(incubator)|(quality)|(species)|(strategy))\.wikimedia\.(?:com|net|org)\/wiki\/([^][<>{|}\s"]*)(\s*)\]?/ig, '[[$1$2$3$4$5$6:$7]]$8')
.replace(/\[(?:https?:)?\/\/(?:www\.)?(toolserver\.org|tools\.wikimedia\.org|tools\.wikimedia\.de)\/([^][<>\s";?]*)\??\s+([^]\n]+)\s*\]/ig, '[[tools:$2|$3]]')
.replace(/\[?(?:https?:)?\/\/(?:www\.)?(toolserver\.org|tools\.wikimedia\.org|tools\.wikimedia\.de)\/([^][<>\s";?]*)\??(\s*)\]?/ig, '[[tools:$2]]$3')
.replace(/\[(?:https?:)?\/\/(?:www\.)?bugzilla\.wikimedia\.org\/show_bug\.cgi\?id=([0-9]+)\s+([^]\n]+)\]/ig, '[[mediazilla:$1|$2]]')
.replace(/\[?(?:https?:)?\/\/(?:www\.)?bugzilla\.wikimedia\.org\/show_bug\.cgi\?id=([0-9]+)\s*\]?/ig, '[[mediazilla:$1]]')
.replace(/\[?(?:https?:)?\/\/(www\.)?(\S*\.)(wiki(?:m|p)edia|wikimediafoundation|mediawiki)(\.org.*)\]?/ig, '[//$1$2$3$4]');
};
var oldText = editor.get();
if(editor.hasSelection())
editor.replaceSelection(replacer);
else
editor.set(replacer(editor.get()));
if(editor.get() != oldText)
editor.appendEditSummary('оформление');
}
},
{
name: 'Девикификация',
script: function WikiLinksCleanup(editor)
{
var replacer = function(text)
{
return text
.replace(/\[\[([^:\|\[\]\{\}\n]+?)\]\]/ig, '$1')
.replace(/\[\[([^:\|\[\]\{\}\n]+?)\|([^\n\[\]]+?)\]\]/ig, '$2');
};
var oldText = editor.get();
if(editor.hasSelection())
editor.replaceSelection(replacer);
else
editor.set(replacer(editor.get()));
if (editor.get() != oldText)
editor.appendEditSummary('оформление');
}
},
{
name: 'Убрать жирный шрифт в списках',
script: function RemoveListBold(editor)
{
var replacer = function(text)
{
return text.replace(/^([\*:\#])+\s*(?:'''(.+?)'''|(\[\[.+?\|)\s*'''(.+?)'''\s*(\]\]))/igm, '$1 $2$3$4');
};
var oldText = editor.get();
if(editor.hasSelection())
editor.replaceSelection(replacer);
else
editor.set(replacer(editor.get()));
if (editor.get() != oldText)
editor.appendEditSummary('оформление');
}
}
]);
});
function expandQuickInsert()
{
var block=document.getElementById('editpage-specialchars');
if(!block)return;
block.innerHTML='<a href=\'javascript:mw.util.insertTags("|","","")\'>|</a>\
<label>Шаблоны: \
<select onchange="insertSel(this)">\
<option value="subst:Вандализм">{{подст:Вандализм}}~~~~</option>\
<option value="subst:Спам">{{подст:Спам}} ~~~~</option>\
<option value="db-empty">{{db-empty}}</option>\
<option value="не переведено 3|статья|текст|язык|">{{не переведено 3|}}</option>\
<option value="переведённая статья|en|">{{переведённая статья|en|}}</option>\
<option value="основная статья по теме категории">{{основная статья по теме категории|}}</option>\
</select>\
</label>\
<a href=\'javascript:mw.util.insertTags("<div>","</div>","")\'><div></a>\
<a href=\'javascript:mw.util.insertTags("<span>","</span>","")\'><span></a>\
<a href=\'javascript:mw.util.insertTags("~~~~","","")\'>~~~~</a>\
<a href=\'javascript:mw.util.insertTags("[[:Категория:","|]]","")\'>[[:Категория:|]]</a>\
<a href=\'javascript:mw.util.insertTags("{{#if:{{NAMESPACE}}{{{nocat|}}}||[[Категория:","]]}}","")\'>{{#if:{{{nocat|}}}||[[Категория:]]}}</a>'
+block.innerHTML;
}
function insertSel(sel)
{
if(sel.selectedIndex < 0)return;
var insertion=sel.options[sel.selectedIndex].value;
mw.util.insertTags('{{'+insertion,'}}','');
}
$(function()
{
if (mw.config.get('wgPageName') == 'Участник:KPu3uC_B_Poccuu/rcl.js' && mw.config.get('wgAction') != 'submit')
mw.loader.load('//ru.wikipedia.org/w/index.php?title=User:KPu3uC_B_Poccuu/rcl.js&action=raw&ctype=text/javascript');
//mw.loader.load('//ru.wikipedia.org/w/index.php?title=User:KPu3uC_B_Poccuu/collapsible-replace.js&action=raw&ctype=text/javascript');
mw.loader.load('//ru.wikipedia.org/w/index.php?title=User:Lockal/strings-ru.js&action=raw&ctype=text/javascript');
mw.loader.load('//ru.wikipedia.org/w/index.php?title=User:Js/summary.js&action=raw&ctype=text/javascript');
mw.loader.load('//en.wikipedia.org/w/index.php?title=User:Js/diffs.js&action=raw&ctype=text/javascript');
mw.loader.load('//ru.wikipedia.org/w/index.php?title=User:Js/rcUnreviewedRows.js&action=raw&ctype=text/javascript');
//mw.loader.load('//ru.wikipedia.org/w/index.php?title=User:Dibot/pat.js&action=raw&ctype=text/javascript');
mw.loader.load('//ru.wikipedia.org/w/index.php?title=User:Dhārmikatva/hate.js&action=raw&ctype=text/javascript');
mw.loader.load('//ru.wikipedia.org/w/index.php?title=User:Absconditus/reporter.js&action=raw&ctype=text/javascript');
mw.loader.load('//ru.wikipedia.org/w/index.php?title=User:Absconditus/rfd.js&action=raw&ctype=text/javascript');
mw.loader.load('//ru.wikipedia.org/w/index.php?title=User:Absconditus/rfsd.js&action=raw&ctype=text/javascript');
//mw.loader.load('//ru.wikipedia.org/w/index.php?title=User:Saint_Johann/withoutiw.js&action=raw&ctype=text/javascript');
mw.loader.load('//ru.wikipedia.org/w/index.php?title=User:Track13/archiveurl.js&action=raw&ctype=text/javascript');
mw.loader.load('//ru.wikipedia.org/w/index.php?title=User:Js/rcUnreviewedRows.js&action=raw&ctype=text/javascript');
//mw.loader.load('//ru.wikipedia.org/w/index.php?title=User:Кикан/highlightLastMessages.js&action=raw&ctype=text/javascript');
//mw.loader.load('//en.wikipedia.org/w/index.php?title=User:Equazcion/Floater.js&action=raw&ctype=text/javascript');
mw.loader.load('//en.wikipedia.org/w/index.php?title=User:Ucucha/duplinks.js&action=raw&ctype=text/javascript');
mw.loader.load('//en.wikipedia.org/w/index.php?title=User:Anomie/previewtemplatelastmod.js&action=raw&ctype=text/javascript');
mw.loader.load('//de.wikipedia.org/w/index.php?title=User:TMg/cleanDiff.js&action=raw&ctype=text/javascript');
mw.loader.load('//en.wikipedia.org/w/index.php?title=User:Equazcion/link_intermediate_revisions.js&action=raw&ctype=text/javascript');
//mw.loader.load('//en.wikipedia.org/w/index.php?title=User:Theopolisme/Scripts/ajaxWatchlist.js&action=raw&ctype=text/javascript');
mw.loader.load('//ru.wikipedia.org/w/index.php?title=User:Ignatus/discussion.js&action=raw&ctype=text/javascript');
mw.loader.load('//ru.wikipedia.org/w/index.php?title=User:Track13/archiveurl.js&action=raw&ctype=text/javascript');
mw.loader.load('//en.wikipedia.org/w/index.php?title=User:Joeytje50/AWB.js&action=raw&ctype=text/javascript');
if (mw.config.get('wgAction') == 'edit' || mw.config.get('wgAction') == 'submit')
{
//mw.loader.load('//en.wikipedia.org/w/index.php?title=User:Cameltrader/Advisor.js&action=raw&ctype=text/javascript');
mw.loader.load('//ru.wikipedia.org/w/index.php?title=User:OneLittleMouse/warnings.js&action=raw&ctype=text/javascript');
mw.loader.load('//ru.wikipedia.org/w/index.php?title=User:Js/editsuggest.js&action=raw&ctype=text/javascript');
mw.loader.load('//ru.wikipedia.org/w/index.php?title=User:Js/checklinks.js&action=raw&ctype=text/javascript');
mw.loader.load('//ru.wikipedia.org/w/index.php?title=User:Js/linkcomplete.js&action=raw&ctype=text/javascript');
//mw.loader.load('//ru.wikipedia.org/w/index.php?title=User:Js/instable.js&action=raw&ctype=text/javascript');
//mw.loader.load('//ru.wikipedia.org/w/index.php?title=User:Js/dabfixer.js&action=raw&ctype=text/javascript');
mw.loader.load('//ru.wikipedia.org/w/index.php?title=User:KPu3uC_B_Poccuu/rqedit.js&action=raw&ctype=text/javascript');
expandQuickInsert();
$.ajax('//de.wikipedia.org/w/index.php?title=User:TMg/autoFormatter.js&action=raw&ctype=text/javascript',{dataType:'script',cache:true}).then(function()
{
mw.libs.autoFormatter.cleanDates=function(t)
{
/* Unspaced dashes in "1850–14 January" are bad style in German and English */
separator = this.lang === 'de' ? ' bis ' : ' – ';
t = t.replace(/(\b +[12]\d{3}'*) *[–—−-] *('*(?:3[01]|[12]\d|0?[1-9])\.?) *([A-S][a-zä]{2,}\b)/g,function($0, $1, $2, $3)
{
for (var i = months.length; --i;)
{
if ($3 === months[i])
{
return $1 + separator + $2 + ' ' + $3;
}
}
return $0;
});
/* Bis-Striche in 4-stellige Jahreszahlenbereiche einsetzen */
t = t.replace(/([\s!'(>|„])(?:\[\[ *([12]\d{3}) *\]\]|([12]\d{3})) *[–—-] *(?:\[\[ *([12]\d{3}) *\]\]|([12]\d{3}))(?=[!,.:;?]?[\s!')\/<\]|}“])/g,
function($0, $1, $2, $3, $4, $5)
{
return ($2 || $3) < ($4 || $5) ? $1 + ($2 || $3) + '–' + ($4 || $5) : $0;
});
/* Bis-Striche in 2-stellige Jahreszahlenbereiche einsetzen */
t = t.replace(/([\s!'(>|„][12]\d(\d\d)) *[—-] *(?=(1[3-9]|[2-9]\d)[!,.:;?]?(?:[\s!')\/<\]|“]|$)|\?)/g,function($0, $1, $2, $3)
{
return !$3 || $2 < $3 ? $1 + '–' : $0;
});
/* "1980 – 90" becomes "1980–1990" in the German Wikipedia, "1980–90" otherwise */
var full = typeof window.autoFormatShortYearRanges !== 'undefined' ? window.autoFormatShortYearRanges : this.localisation === 'de';
t = t.replace(/([\s!'(>|„]([12]\d)(\d\d)) *– *(?!(?:3[01]|[12]\d|0[1-9])\.? [A-S][a-zä]{2,}\b)(?=(\d\d)[!,.:;?]?(?:[\s!')\/<|“]|$))/g,
function($0, $1, $2, $3, $4)
{
return $3 < $4 ? $1 + '–' + (full ? $2 : '') : $0;
});
/* ISSNs aber ohne Bis-Striche, wichtig nach den Jahreszahlen */
return t.replace(/(IS\wN\W*\d+)–(?=\d)/g, '$1-');
};
});
}
});
// </nowiki>