User:JamesR/catdelete.js

// Easy Category Deletion for EMPTY CATEGORIES (per CSD#C1)

// Created by User:JamesR

// Navigate to the valid empty Category:* page and click on the "emptycat" tab to delete it instantly.

importScript('Wikipedia:WikiProject User scripts/Scripts/Add tab');

addOnloadHook(function (){

if (location.href.indexOf("&action=delete&catdel=yes") == -1) return; //Are we here to auto-edit the form?

//Modify the form

document.getElementById('wpReason').value = "C1: Empty category. (CatDel)";

//Submit it!

document.getElementById('deleteconfirm').submit();

});

addOnloadHook(function (){

mw.util.addPortletLink("p-cactions", "http://en.wikipedia.org/w/index.php?title=Category%3A" + wgTitle + "&action=delete&catdel=yes", "emptycat", "emptycat", "Delete empty category");

});