MediaWiki:Botcheck.js
Jump to navigation
Jump to search
Note: After saving, you have to bypass your browser's cache to see the changes. Internet Explorer: press Ctrl-F5, Mozilla: hold down Shift while clicking Reload (or press Ctrl-Shift-R), Opera/Konqueror: press F5, Safari: hold down Shift + Alt while clicking Reload, Chrome: hold down Shift while clicking Reload.
Documentation for this user script can be added at MediaWiki:Botcheck. |
- Report page listing warnings and errors.
// <source lang="javascript">
/*
Quick helper script for bot move checks. Called via a special link in [[Template:BotMoveToCommons]].
Original author of Catcheck.js: [[User:Lupo]], September 2008
Modified by [[User:Multichill]] to work with [[Template:BotMoveToCommons]]
License: Quadruple licensed GFDL, GPL, LGPL and Creative Commons Attribution 3.0 (CC-BY-3.0)
Choose whichever license of these you like best :-)
*/
if (mw.config.get('wgNamespaceNumber') == 6 && mw.config.get('wgAction') == 'edit') {
$(document).ready(function () {
var text = document.getElementById ('wpTextbox1');
if (!text) return;
// Remove "BotMoveToCommons" tag
text.value = text.value.replace (/\{\{[bB]otMoveToCommons[^}]*\}\}\n*/g, "")
.replace (/\{\{CH2MoveToCommons[^}]*\}\}\n*/g, "")
.replace (/The upload bot is \[\[User:CommonsHelper2 Bot\]\] which is called by \[http:\/\/toolserver.org\/\~commonshelper2\/index.php CommonsHelper2\].\n*/g, "")
.replace (/The tool and the bot are operated by \[\[User:Jan Luca\]\] and \[\[User:Magnus Manske\]\].\n*/g, "")
.replace (/\n*\_\_NOTOC\_\_\n*/g, "\n\n")
.replace ('{{GFDL}}\n<!-- Templates "Template:Lizenzdesign4", "Template:Lizenzumstellung" were used in the original description page as well , but do not appear to exist on commons. -->', "{{GFDL|migration=relicense}}")
// Remove any whitespace from the end and top
.replace(/^\s*((?:.|\n)+?)\s*$/, "$1");
// Remove any whitespace from beginning and end
text.value = $.trim( text.value || "" );
// Set edit summary
var add = "This bot move has been checked";
var summary = document.getElementById ('wpSummary');
if (!summary) return;
var val = $.trim( summary.value || "" );
if (val.indexOf(add) != -1) return;
summary.value = (val.length == 0) ? add : val + " " + add;
});
}
// </source>