User:Ale jrb/Scripts/csdcheck.js: Difference between revisions

Content deleted Content added
Ale jrb (talk | contribs)
m .
Ale jrb (talk | contribs)
m clean
Line 1:
// CSD thing
if ((wgAction == 'delete') && (csdCheckEnable == true)) {
function csdCheck () {
Line 6 ⟶ 5:
function ajaxDone(content) {
// reasons_regex taken from existing sysop script, because it works well. :)
var reasons_regex = {
'G10': // copied from [[User:Ilmari Karonen]]'s script, covers more bases than the others since it's more important (this script should blank the summary in _all_ cases where the other script does
Line 16 ⟶ 14:
'G4': /\{\{\s*((db-|csd[-:])?(repost|g4)|deleteagain)\s*\}\}/i,
'G5': /\{\{\s*(db-|csd[-:])?(banned|ban|g5)\s*\}\}/i,
'G6': /\{\{\s*(db-|csd[-:])?(maintenance|move|histmerge|g6)\s*\}\}/i, // db-move and db-histmerge should be covered elsewhere if possible
'G7': /\{\{\s*(db-|csd[-:])?(author|blanked|g7)\s*\}\}/i,
'G8': /\{\{\s*(db-|csd[-:])?(talk|g8|redirnone|r1)\s*\}\}/i,
Line 40 ⟶ 38:
'U1': /\{\{\s*(db-|csd[-:])?(userreq|u1|user)\s*\}\}/i,
'I2': /\{\{\s*(db-|csd[-:])?(noimage|i2)\s*\}\}/i,
// no point in including the other image categories here, this will only work
// when deleting a description page with no image
// R1 = G8
Line 48 ⟶ 43:
'R3': /\{\{\s*(db-|csd[-:])?(redirtypo|r3)\s*\}\}/i,
'dummy': //
'dummy': /this will never be reached, it is there to allow every entry above to end in a comma/
}
Line 60 ⟶ 55:
}
function findCSD(s) { // s e.g. "U1", "G10"
for(var i=0;i<list.options.length;i++) {
var o=list.options[i];
if (o.text.indexOf("CSD#"+s+"|") ==> 0-1) return o;
}
}