User:Selket/csd.js

/* */

if (document.title.indexOf("Confirm delete") != -1) { 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<arr.length;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":"CSD G1: Patent Nonsense","display":"G1 - Nonsense"}, {"value":"CSD G2: Test Pages","display":"G2 - Test Pages"}, {"value":"CSD G3: Pure Vandalism","display":"G3 - Pure Vandalism"}, {"value":"CSD G4: Recreation of Deleted Material","display":"G4 - Recreated Deleted"}, {"value":"CSD G5: Contributions by Banned User","display":"G5 - Banned User"}, {"value":"CSD G6: Housekeeping","display":"G6 - Housekeeping"}, {"value":"CSD G7: Author Requests Deletion","display":"G7 - Author Request"}, {"value":"CSD G8: Talkpage of non-Existent Article","display":"G8 - Talk Page"}, {"value":"CSD G9: Office Actions","display":"G9 - Office Actions"}, {"value":"CSD G10: Attack Page","display":"G10 - Attack Pages"}, {"value":"CSD G11: Blatant Advertising","display":"G11 - Advertising"}, {"value":"CSD G12: Blatant Copyright Infringement","display":"G12 - Copyright"}, {"value":"CSD A1: Very Short Article Providing Little or no Context","display":"A1 - No Context"}, {"value":"CSD A2: Foreign Language Article that Exists on Another Wikipedia","display":"A2 - Foreign Language"}, {"value":"CSD A3: No Content","display":"A3 - No Content"}, {"value":"CSD A5: Has Been Transwikied","display":"A5 - Transwikied"}, {"value":"CSD A7: Article does not assert the notability of its subject","display":"A7 - Unremarkable"}, {"value":"CSD R1: Redirect to non-Existent Page","display":"R1 - Bad Target"}, {"value":"CSD R2: Redirect to User/User Talk Namespaces from Mainspace","display":"R2 - Crossnamespace"}, {"value":"CSD R3: Implausible Typo","display":"R3 - Bad Typo"}, {"value":"CSD I1: Redundant to Another Image","display":"I1 - Redundant"}, {"value":"CSD I2: Image is Corrupted","display":"I2 - Corrupt/Empty"}, {"value":"CSD I3: Improper License","display":"I3 - Improper License"}, {"value":"CSD I4: No License","display":"I4 - Lack of License"}, {"value":"CSD I5: Is Unused and not Free","display":"I5 - Unused Unfree"}, {"value":"CSD I6: No Justification Given for Fair Use","display":"I6 - No Fair Use"}, {"value":"CSD I7: Bad Justification Given for Fair Use","display":"I7 - Invalid Fair Use"}, {"value":"CSD I8: Image Exists on the Commons","display":"I8 - On Commons"}, {"value":"CSD C1: Category is Empty","display":"C1 - Empty"}, {"value":"CSD C2: Speedy Renaming","display":"C2 - Speedy Rename"}, {"value":"CSD C3: Corresponding Template was Deleted","display":"C3 - Template"}, {"value":"CSD U1: User Requested Deletion","display":"U1 - User Request"}, {"value":"CSD U2: Userpage of non-Existent User","display":"U2 - No User"}, {"value":"CSD U3: Userpage that is Primarily a Gallery of Fair Use Images","display":"U3 - Fair Use Gallery"}, {"value":"CSD T1: Template that is Divisive and Inflammatory.","display":"T1 - Divisive"}, {"value":"CSD P1: Any Topic that Would be Subject to Speedy Deletion as an Article.","display":"P1 - Speedy Article"}, {"value":"CSD P2: Underpopulated","display":"P2 - Underpopulated"} ],				//**************************** 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'); // 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'); obj.value = document.getElementById('csdOptions').value; }

/* */