Jump to content

User:AuburnPilot/csd.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.
/* <pre><nowiki> */

if (mw.config.get('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]]: [[WP:PN|Patent Nonsense]]","display":"G1 - Nonsense"},
                                        {"value":"[[WP:CSD#G2|CSD G2]]: Test Pages","display":"G2 - Test Pages"},
                                        {"value":"[[WP:CSD#G3|CSD G3]]: [[WP:VAND|Pure Vandalism]]","display":"G3 - Pure Vandalism"},
                                        {"value":"[[WP:CSD#G4|CSD G4]]: Recreation of deleted material","display":"G4 - Recreated Deleted"},
                                        {"value":"[[WP:CSD#G5|CSD G5]]: Contributions by [[Wikipedia:List of banned users|Banned User]]","display":"G5 - Banned User"},
                                        {"value":"[[WP:CSD#G6|CSD G6]]: Housekeeping","display":"G6 - Housekeeping"},
                                        {"value":"[[WP:CSD#G7|CSD G7]]: Only one editor has made substantial edits to this page and he or she has requested its deletion or blanked the page","display":"G7 - Author Request"},
                                        {"value":"[[WP:CSD#G8|CSD G8]]: Pages dependent on a non-existent or deleted page","display":"G8 - Dependent page"},
                                        {"value":"[[WP:CSD#G10|CSD G10]]: [[Wikipedia:Attack page|Attack Page]]","display":"G10 - Attack Pages"},
                                        {"value":"[[WP:CSD#G11|CSD G11]]: [[WP:SPAM|Blatant Advertising]]","display":"G11 - Advertising"},
                                        {"value":"[[WP:CSD#G12|CSD G12]]: [[WP:C|Copyright infringement]]","display":"G12 - Copyright"},
                                        {"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 [[WP:MUSIC|significance]]","display":"A7 - Unremarkable Band"},
                                        {"value":"[[WP:CSD#A7|CSD A7 (Corp)]]: Article about a company that doesn't assert [[WP:CORP|significance]]","display":"A7 - Unremarkable Firm"},
                                        {"value":"[[WP:CSD#A7|CSD A7 (Web)]]: Article about a web site that does not assert [[WP:WEB|significance]]","display":"A7 - Unremarkable Web"},
                                        {"value":"[[WP:CSD#A7|CSD A7]]: Article about subject that does not assert significance.","display":"A7 - Other"},
                                        {"value":"[[WP:CSD#A9|CSD A9]]: Article about a musical recording that does not assert significance.","display":"A9 - Unremarkable music"},
                                        {"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#F1|CSD F1]]: Redundant to another image","display":"F1 - Redundant"},
                                        {"value":"[[WP:CSD#F2|CSD F2]]: Fil is corrupted","display":"F2 - Corrupt/Empty"},
                                        {"value":"[[WP:CSD#F3|CSD F3]]: Improper license","display":"F3 - Improper License"},
                                        {"value":"[[WP:CSD#F4|CSD F4]]: No license or No Source Information","display":"F4 - Lack of License"},
                                        {"value":"[[WP:CSD#F5|CSD F5]]: File is unused and [[WP:NFCC|not free]]","display":"F5 - Unused Unfree"},
                                        {"value":"[[WP:CSD#F6|CSD F6]]: No [[WP:FURG|justification]] given for fair use","display":"F6 - No Fair Use"},
                                        {"value":"[[WP:CSD#F7|CSD F7]]: Bad [[WP:FURG|justification]] given for fair use","display":"F7 - Invalid Fair Use"},
                                        {"value":"[[WP:CSD#F8|CSD F8]]: File exists on [[commons:Main Page|Wikimedia Commons]]","display":"F8 - On Commons"},
                                        {"value":"[[WP:CSD#F9|CSD F9]]: [[WP:C|Copyright infringement]]","display":"F9 - Copyright"},
                                        {"value":"[[WP:CSD#F10|CSD F10]]: File that is neither image, sound, nor video with no encyclopedic use.","display":"F10 - Useless"},
                                        {"value":"[[WP:CSD#F11|CSD F11]]: No evidence of permission","display":"F11 - No permission"},
                                        {"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#G8|CSD G8]]: Pages dependent on a non-existent or deleted page", "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 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#G10|CSD G10]]: [[Wikipedia:Attack page|Attack Page]]","display":"T1 - Divisive"},
                                        {"value":"[[WP:CSD#T2|CSD T2]]: Unambiguous misrepresentations of established policy","display":"T2 - Misrepresentation"},
                                        {"value":"[[WP:CSD#T3|CSD T3]]: Unused, redundant template","display":"T3 - Unused duplicate"},
                                        {"value":"[[WP:CSD#P1|CSD P1]]: [[WP:P|Portal]] page that would be subject to speedy deletion as an article","display":"P1 - Otherwise speedy"},
                                        {"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#MYSPACE|Wikipedia is not MySpace or any other social networking site]]","display":"WP:NOT#SOCIAL"},
                                        {"value":"[[:Category:Temporary Wikipedian userpages|Page of an indefinitely blocked user]]","display":"Blocked user"},
                                        {"value":"[[WP:AFD|AFD]]: Deleted after discussion at Articles for Deletion","display":"AFD close"},
                                        {"value":"[[WP:PROD|Prod]] left uncontested for five days.","display":"Prod close"}
                                        ],
				//**************************** 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> */