MediaWiki:Gadget-CleanDeleteReasons.js

From Wikinews, the free news source you can write!
Jump to navigation Jump to search

Note: After saving, you may have to bypass your browser's cache to see the changes. Mozilla / Firefox / Safari: hold down Shift while clicking Reload, or press Ctrl-Shift-R (Cmd-Shift-R on Apple Mac); IE: hold Ctrl while clicking Refresh, or press Ctrl-F5; Konqueror: simply click the Reload button, or press F5; Opera users may need to completely clear their cache in Tools→Preferences. — More skins

try { // containerize gadget, to protect other gadgets if this one goes wrong

//Stolen from  (en) wikibooks Written by [[User:Mike.lifeguard]]. - http://en.wikibooks.org/wiki/MediaWiki:Gadget-CleanDeleteReasons.js
//If this acts up on wikinews, feel free to complain to [[user:Bawolff]].
function deletemods(){
	var wpReason = document.getElementById("wpReason");
	if (!wpReason) return;
	var regexp = /(content was|page was empty|content before blanking was|page was empty)/i;
	if (regexp.test(wpReason.value)){
		wpReason.value = "";
	}
}
if (mw.config.get('wgAction') == "delete") $(deletemods);

} catch (e) { // containerize gadget, to protect other gadgets if this one goes wrong
  // ignore
}