// <nowiki>
mw.config.set('userjs-templatescript', { regexEditor: false });
$.ajax("//tools-static.wmflabs.org/meta/scripts/pathoschild.templatescript.js", { dataType: "script", cache: true }).then(function () {
pathoschild.TemplateScript.add([
{
name: 'Formatter/Tagger',
tooltip: 'Formatting and tagging unreliable sources',
script: function (editor) {
runFunction(editor, 'all');
}
},
{
name: 'Tagger',
tooltip: 'Tagging unreliable sources',
script: function (editor) {
runFunction(editor, 'tagger');
}
},
{
name: 'Settings',
tooltip: 'Settings',
script: function () {
runSettings();
}
}
],
{
category: 'Paper9ollScripts',
forActions: 'edit',
forNamespaces: [0, 2, 118]
});
});
function loadScript(callback) {
if (mw.config.get('wgDBname') === 'enwiki') {
var script = document.createElement('script');
script.type = 'text/javascript';
var url = '//en.wikipedia.org/w/index.php?title=User:Paper9oll/FormatterTagger-core.js&action=raw&ctype=text/javascript';
var cacheBuster = 'cache=' + Date.now();
url += (url.indexOf('?') === -1 ? '?' : '&') + cacheBuster;
script.src = url;
script.onload = callback;
document.head.appendChild(script);
}
}
function runSettings() {
loadScript(function () {
init.checkVersion();
settings.settings();
});
}
function runFunction(editor, type) {
loadScript(function () {
init.checkVersion();
warning.user(editor);
warning.usageWarning().then(function () {
if (type !== 'tagger') {
logger.clear();
hatnotes.hatnotes(editor);
typography.typography(editor);
infobox.infobox(editor);
wikitable.wikitable(editor);
template.template(editor);
efn.format(editor);
cite.cite(editor);
}
if (type === 'tagger' || type === 'all') {
unreliableSource.KO(editor);
unreliableSource.RSP(editor);
}
if (type === 'all') {
editSummary.auto(editor);
}
else if (type === 'tagger') {
editSummary.tagger(editor);
}
});
});
}
// </nowiki>