User:Zzuuzz/csd.js

From Wikipedia, the free encyclopedia

Note: After saving, you have to bypass your browser's cache to see the changes. In Internet Explorer and Firefox, hold down the Ctrl key and click the Refresh or Reload button. Opera users have to clear their caches through Tools→Preferences, see the instructions for Opera. Konqueror and Safari users can just click the Reload button.

/* <pre><nowiki> */
 
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 < 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":"[[WP:CSD#G1|CSD G1]]: [Wikipedia:Patent nonsense|Patent nonsense]]", "display":"G1 - Nonsense"},
		{"value":"[[WP:CSD#G2|CSD G2]]: Test pages", "display":"G2 - Test pages"},
		{"value":"[[WP:CSD#G3|CSD G3]]: [[Wikipedia:Vandalism|Vandalism]]","display":"G3 - Vandalism"},
		{"value":"[[WP:CSD#G4|CSD G4]]: Recreation of deleted material", "display":"G4 - Recreated deleted"},
		{"value":"[[WP:CSD#G5|CSD G5]]: Contributions by [[Wikipedia:Banning policy|Banned user]]", "display":"G5 - Banned user"},
		{"value":"[[WP:CSD#G6|CSD G6]]: Housekeeping", "display":"G6 - Housekeeping"},
		{"value":"[[WP:CSD#G7|CSD G7]]: Author requests deletion", "display":"G7 - Author request"},
		{"value":"[[WP:CSD#G8|CSD G8]]: Talkpage of non-existent article", "display":"G8 - Talk page"},
		{"value":"[[WP:CSD#G10|CSD G10]]: [[Wikipedia:Attack page|Attack page]]", "display":"G10 - Attack pages"},
		{"value":"[[WP:CSD#G11|CSD G11]]: [[Wikipedia:Spam|Blatant advertising]]", "display":"G11 - Blatant advertising"},
		{"value":"[[WP:CSD#G12|CSD G12]]: [[Wikipedia:Copyright|Blatant copyright infringement]]", "display":"G12 - Copyright infringement"},
		{"value":"[[WP:CSD#A1|CSD A1]]: Very short article providing little or no context", "display":"A1 - No context"},
		{"value":"[[WP:CSD#A2|CSD A2]]: Foreign language article that exists on another Wikipedia", "display":"A2 - Foreign language"},
		{"value":"[[WP:CSD#A3|CSD A3]]: No meaningful content", "display":"A3 - No content"},
		{"value":"[[WP:CSD#A5|CSD A5]]: Has been transwikied", "display":"A5 - Transwikied"},
		{"value":"[[WP:CSD#A7|CSD A7 (Bio)]]: Biographical article that does not assert significance", "display":"A7 - Unremarkable bio"},
		{"value":"[[WP:CSD#A7|CSD A7 (Group)]]: Article about a club or group that does not assert significance", "display":"A7 - Unremarkable group"},
		{"value":"[[WP:CSD#A7|CSD A7 (Band)]]: Article about a band that does not assert [[Wikipedia:Notability (music)|significance]]", "display":"A7 - Unremarkable band"},
		{"value":"[[WP:CSD#A7|CSD A7 (Corp)]]: Article about a company that does not assert [[Wikipedia:Notability (organizations and companies)|significance]]", "display":"A7 - Unremarkable company"},
		{"value":"[[WP:CSD#A7|CSD A7 (Web)]]: Article about a website that does not assert [[Wikipedia:Notability (web)|significance]]", "display":"A7 - Unremarkable website"},
		{"value":"[[WP:CSD#A7|CSD A7]]: Article about subject that does not assert [[Wikipedia:Notability|significance]]", "display":"A7 - Other"},
		{"value":"[[WP:CSD#R1|CSD R1]]: Redirect to non-existent page", "display":"R1 - Bad target"},
		{"value":"[[WP:CSD#R2|CSD R2]]: Redirect to User/User talk namespaces from mainspace", "display":"R2 - Crossnamespace"},
		{"value":"[[WP:CSD#R3|CSD R3]]: Implausible typo", "display":"R3 - Bad typo"},
		{"value":"[[WP:CSD#I1|CSD I1]]: Redundant to another image", "display":"I1 - Redundant"},
		{"value":"[[WP:CSD#I2|CSD I2]]: Image is corrupted or empty", "display":"I2 - Corrupt or empty"},
		{"value":"[[WP:CSD#I3|CSD I3]]: Improper license", "display":"I3 - Improper license"},
		{"value":"[[WP:CSD#I4|CSD I4]]: No license or no source information", "display":"I4 - Lack of license"},
		{"value":"[[WP:CSD#I5|CSD I5]]: Image is unused and [[Wikipedia:Non-free content criteria|not free]]", "display":"I5 - Unused unfree"},
		{"value":"[[WP:CSD#I6|CSD I6]]: No [[Wikipedia:Non-free use rationale guideline|justification]] given for fair use", "display":"I6 - No fair use"},
		{"value":"[[WP:CSD#I7|CSD I7]]: Bad [[Wikipedia:Non-free use rationale guideline|justification]] given for fair use", "display":"I7 - Invalid fair use"},
		{"value":"[[WP:CSD#I8|CSD I8]]: Image exists on the Commons", "display":"I8 - On Commons"},
		{"value":"[[WP:CSD#I9|CSD I9]]: [[Wikipedia:Copyright|Blatant copyright infringement]]", "display":"I9 - Copyright violation"},
		{"value":"[[WP:CSD#C1|CSD C1]]: Category is empty (and has been for 4 days or more)", "display":"C1 - Empty"},
		{"value":"[[WP:CSD#C2|CSD C2]]: Speedy renaming", "display":"C2 - Speedy rename"},
		{"value":"[[WP:CSD#C3|CSD C3]]: Corresponding template was deleted", "display":"C3 - Template"},
		{"value":"[[WP:CSD#U1|CSD U1]]: User requested deletion", "display":"U1 - User request"},
		{"value":"[[WP:CSD#U2|CSD U2]]: Userpage of non-existent user", "display":"U2 - No such user"},
		{"value":"[[WP:CSD#U3|CSD U3]]: Userpage that is primarily a gallery of fair use images", "display":"U3 - Fair use gallery"},
		{"value":"[[WP:CSD#T1|CSD T1]]: Template that is divisive and inflammatory", "display":"T1 - Divisive"},
		{"value":"[[WP:CSD#T2|CSD T2]]: Template that misrepresents established policy", "display":"T2 - Misrepresents policy"},
		{"value":"[[WP:CSD#T3|CSD T3]]: Redundant template", "display":"T3 - Redundant"},
		{"value":"[[WP:CSD#P2|CSD P2]]: Underpopulated", "display":"P2 - Underpopulated"},
		{"value":"[[WP:NOT#PUBLISHER|Wikipedia is not a place for cool ideas or neologisms]]", "display":"WP:NOT#OR"},
		{"value":"[[WP:NOT#BUREAUCRACY|Wikipedia is not a bureaucracy]]", "display":"WP:NOT#BUREAUCRACY"},
		{"value":"[[WP:NOT#MYSPACE|Wikipedia is not MySpace]]", "display":"WP:NOT#MYSPACE"},
		{"value":"[[:Category:Temporary Wikipedian userpages|Temporary talk page of blocked user]]", "display":"Blocked user talk"},
		{"value":"[[WP:AFD|AFD]]: Deleted after discussion at Articles for Deletion", "display":"AFD close"},
		{"value":"[[WP:PROD|Prod]] left uncontested for five days.", "display":"Expired PROD"}
		],
		//**************************** 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;
}
 
/* </nowiki><pre> */