Jump to content

User:Ilmari Karonen/cleandelsummary.js

From Wikipedia, the free encyclopedia
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.
// CLEAN DELETION SUMMARY FOR ATTACK PAGES

if (wgAction == "delete") {
    addOnloadHook(function () {
        var wpReason = document.getElementById("wpReason");
        if (!wpReason) return;
        var regexp = /\{\{\s*(msg:\s*)?(template:\s*)?(db-a(p|tk)?|((csd|db)[-:])?(a6|attack(pages?|template)?|g10))\s*[|}]/i;
        if (regexp.test(wpReason.value))
            wpReason.value = "[[WP:CSD#G10|CSD G10]]: [[Wikipedia:Attack page|Attack Page]]";
    });
}

/*
 * Note: These are the known redirects to [[Template:Db-attack]] as of 7 Jun 2007.
 * The regexp above should catch these as well as a number of possible variants.
 *
 * [[Template:A6]]
 * [[Template:Attackpage]]
 * [[Template:Attackpages]]
 * [[Template:CSD:G10]]
 * [[Template:Csd-a6]]
 * [[Template:Db-Attack]]
 * [[Template:Db-a]]
 * [[Template:Db-a6]]
 * [[Template:Db-ap]]
 * [[Template:Db-atk]]
 * [[Template:Db-attack]]
 * [[Template:Db-attacktemplate]]
 * [[Template:Db-g10]]
 * [[Template:G10]]
 */