MediaWiki:Catcheck.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:Catcheck. |
// <nowiki>
/*
Quick helper script for category checks. Called via a special link in [[Template:Check categories]] or [[Template:Check categories-Geograph]] or [[Special:PrefixIndex/Template:Check_categories]]
Author: [[User:Lupo]], September 2008
License: Quadruple licensed GFDL, GPL, LGPL and Creative Commons Attribution 3.0 (CC-BY-3.0)
Choose whichever license of these you like best :-)
*/
/*jshint curly:false*/
/*global mw:false, $:false*/
$(function() {
'use strict';
if (mw.config.get('wgNamespaceNumber') !== 6 || mw.config.get('wgAction') !== 'edit') {
return;
}
window.Catcheck =
{
run : function ()
{
var text = document.getElementById ('wpTextbox1');
if (!text) return;
// Remove "Check categories" tag
text.value = (text.value || "").replace (/\{\{[Cc]heck[ _]categories[^\}\{]*\}\}\n*/g, "");
// Set edit summary
var summary = document.getElementById ('wpSummary');
if (!summary) return;
var val = summary.value || "";
summary.value = val + (val ? ' ' : "") +
"Categories have been checked - [[:Category:Media needing category review|You can help!]]";
}
};
window.Catcheck.run();
});
// </nowiki>