User:Seb26/monobook.js/csd.js
/*
*/ /* This is a copy of User:^demon's CSD AutoReason software (User:^demon/csd.js) modified for
Spebi's own personal use
- /
if (wgAction == 'delete') {
var csdDeleteForm = {
FillSelect:function(sel, arr){
if(arr && arr.length>0){
if(arr.length>1){
var FirstOpt = new Option("CSD Reasons", "");
// catches stupid IE error
if(FirstOpt.innerHTML != "CSD Reasons"){
FirstOpt.innerHTML = "CSD Reasons";
}
sel.appendChild(FirstOpt);
sel.options[0].style.color = "gray"
}
sel.disabled = false;
for(var i=0;i
var opt = new Option(arr[i].display, arr[i].value);
// catches stupid IE error
if(opt.innerHTML != arr[i].display){
opt.innerHTML = arr[i].display;
}
sel.appendChild(opt);
}
}else{
sel.options[0] = new Option("No Options Available", "");
// catches stupid IE error
if(sel.options[0].innerHTML != "No Options Available"){
sel.options[0].innerHTML = "No Options Available";
}
sel.disabled = true;
return false;
}
return true;
},
ValueArray:[
{"value":"Patent nonsense (G1)","display":"G1 - Nonsense"},
{"value":"Test page (G2)","display":"G2 - Test Pages"},
{"value":"Vandalism (G3)","display":"G3 - Pure Vandalism"},
{"value":"Recreation of deleted material (G4)","display":"G4 - Recreated Deleted"},
{"value":"Contributions of banned user (G5)","display":"G5 - Banned User"},
{"value":"Housekeeping (G6)","display":"G6 - Housekeeping"},
{"value":"Only one editor has made substantial edits to this page and he or she has requested its deletion or blanked the page (G7)","display":"G7 - Author Request"},
{"value":"Talk page of an inexistent article (G8)","display":"G8 - Talk Page"},
{"value":"Attack page (G10)","display":"G10 - Attack Pages"},
{"value":"Blatant advertising (G11)","display":"G11 - Advertising"},
{"value":"Copyright infringement (G12)","display":"G12 - Copyright"},
{"value":"Very short article providing little or no context (A1)","display":"A1 - No Context"},
{"value":"Foreign language article that exists on another Wikipedia (A2)","display":"A2 - Foreign Language"},
{"value":"No meaningful content (A3)","display":"A3 - No Content"},
{"value":"Article transwikiied (A5)","display":"A5 - Transwikied"},
{"value":"Biographical article that does not assert significance (A7 (Bio))","display":"A7 - Unremarkable Bio"},
{"value":"Article about a club or group that does not assert significance (A7 (Group))","display":"A7 - Unremarkable Group"},
{"value":"Article about a band that does not assert significance (A7 (Band))","display":"A7 - Unremarkable Band"},
{"value":"Article about a company that doesn't assert significance (A7 (Corp))","display":"A7 - Unremarkable Firm"},
{"value":"Article about a web site that does not assert significance (A7 (Web))","display":"A7 - Unremarkable Web"},
{"value":"Article about subject that does not assert significance (A7)","display":"A7 - Other"},
{"value":"Redirect to inexistent page(R1)","display":"R1 - Bad Target"},
{"value":"Mainspace redirect to user space (R2)","display":"R2 - Crossnamespace"},
{"value":"Implausible typo (R3)","display":"R3 - Bad Typo"},
{"value":"Redundant to another image (I1)","display":"I1 - Redundant"},
{"value":"Corrupted image (I2)","display":"I2 - Corrupt/Empty"},
{"value":"Improper image license (I3)","display":"I3 - Improper License"},
{"value":"No license or no source information (I4)","display":"I4 - Lack of License"},
{"value":"Image is unused and not free (I5)","display":"I5 - Unused Unfree"},
{"value":"No justification given for fair use(I6)","display":"I6 - No Fair Use"},
{"value":"Bad justification given for fair use (I7)","display":"I7 - Invalid Fair Use"},
{"value":"Image exists on Commons (I8)","display":"I8 - On Commons"},
{"value":"Category empty for more than 4 days (C1)","display":"C1 - Empty"},
{"value":"Speedy renaming (C2)","display":"C2 - Speedy Rename"},
{"value":"Corresponding template was deleted (C3)","display":"C3 - Template"},
{"value":"User requested deletion (U1)","display":"U1 - User Request"},
{"value":"User page of inexistent user (U2)","display":"U2 - No User"},
{"value":"Fair use gallery on user page (U3)","display":"U3 - Fair Use Gallery"},
{"value":"Divisive and inflammatory template (T1)","display":"T1 - Divisive"},
{"value":"Underpopulated portal (P2)","display":"P2 - Underpopulated"},
{"value":"(Talk page of an indefinitely blocked user","display":"Blocked user"},
],
//**************************** attaching function *****************************************
// got thIS super handi function from http://www.scottandrew.com he is pretty dang smart **
//*****************************************************************************************
addEvent:function(obj, evType, fn, useCapture){
//alert(obj);
if (obj.addEventListener){
obj.addEventListener(evType, fn, useCapture);
return true;
} else if (obj.attachEvent){
var r = obj.attachEvent("on"+evType, fn);
return r;
} else {
alert("Handler could not be attached");
}
}
}
function addSelectAfter(){
var obj = document.getElementById('wpReason') || document.getElementById('wpComment');
// create select using included array
var sel = document.createElement("SELECT");
csdDeleteForm .FillSelect(sel, csdDeleteForm .ValueArray);
// name it
sel.name = "csdOptions";
sel.id = "csdOptions";
sel.style.marginLeft = "10px";
csdDeleteForm .addEvent(sel, "change", csdChangeBox, false);
// check for next sibling and insert before it or at the end
if(obj.nextSibling){
obj.parentNode.insertBefore(sel,obj.nextSibling);
}else{
obj.parentNode.appendChild(sel);
}
}
try{
// add one on load
csdDeleteForm.addEvent(window, "load", addSelectAfter, false);
}catch(err){}
}
function csdChangeBox() {
var obj = document.getElementById('wpReason') || document.getElementById('wpComment');
obj.value = document.getElementById('csdOptions').value;
}
/*
*/