// <nowiki>
/*
This, that and the other's Cleanup Cleanup script
February 2012; updated May 2012
This script offers a quick way to remove {{cleanup}} tags that lack a reason= parameter.
To use it, add the following two lines to your skin JavaScript file:
importScript("MediaWiki:Gadget-morebits.js");
importScript("User:This, that and the other/cleanupCleanup.js");
*/
$(function() {
var para = document.createElement("p");
para.style.fontSize = "85%";
var link = document.createElement("a");
link.setAttribute("href", "#remove-cleanup");
link.textContent = "Remove this {{cleanup}} tag (if it lacks a reason)";
link.style.color = "maroon";
para.appendChild(link);
$("table.ambox-Cleanup td.mbox-text").append(para);
$(link).click(function() {
var page = new Morebits.wiki.page(wgPageName);
page.setFollowRedirect(false);
link.innerHTML = "Processing..."; // hack to remove onclick event handler
page.load(function(pageobj) {
pageobj.setPageText(pageobj.getPageText().replace(/\{\{(Cleanup|Cleanup section|Cleanup-section|Clean-up section|Attention|Attention \(on talk page\)|Attention see talk|Attn|CU|Celan-up|Clean|Clean up|Clean-up|Cleancat|Cleanup-article|Cleanup-because|Cleanup-date|Cleanup-quality|Cleanup-reason|Cleanup-since|Clu|Cu|Improve|Index-cleanup|Quality|Spelling|Tidy)([^}]*)\}\}\n*/i, ""));
pageobj.setEditSummary("Removing {{cleanup}} tag without a reason ([[User:This, that and the other/cleanupCleanup.js|script-assisted edit]])");
pageobj.save(function() {
location.reload();
});
});
});
});
// </nowiki>