User:This, that and the other/cleanupCleanup.js
Jump to navigation
Jump to search
Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.
Code that you insert on this page could contain malicious content capable of compromising your account. If you import a script from another page with "importScript", "mw.loader.load", "iusc", or "lusc", take note that this causes you to dynamically load a remote script, which could be changed by others. Editors are responsible for all edits and actions they perform, including by scripts. User scripts are not centrally supported and may malfunction or become inoperable due to software changes. A guide to help you find broken scripts is available. If you are unsure whether code you are adding to this page is safe, you can ask at the appropriate village pump. This code will be executed when previewing this page. |
Documentation for this user script can be added at User:This, that and the other/cleanupCleanup. |
// <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>