Code that you insert on this page could contain malicious content capable of compromising your account. If you import a script from another page with "importScript", "mw.loader.load", "iusc", or "lusc", take note that this causes you to dynamically load a remote script, which could be changed by others. Editors are responsible for all edits and actions they perform, including by scripts. User scripts are not centrally supported and may malfunction or become inoperable due to software changes. A guide to help you find broken scripts is available. If you are unsure whether code you are adding to this page is safe, you can ask at the appropriate village pump. This code will be executed when previewing this page.
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.
varcsdCheckEnable=true;// CSD thingif((wgAction=='delete')&&(csdCheckEnable==true)){(function(){varlist=document.getElementById('wpDeleteReasonList');vartd=document.createElement('td');td.setAttribute('id','csdCheck');document.getElementById('wpReason').parentNode.appendChild(td);document.getElementById('csdCheck').innerHTML='Checking for CSD tags...';ajaxPageContent(wgPageName);functionajaxDone(content){// reasons_regex taken from existing sysop script, because it works well. :)varreasons_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/\{\{\s*(msg:\s*)?(template:\s*)?(db-a(p|tk)?|((csd|db)[-:])?(a6|attack(pages?|template)?|g10))\s*[|}]/i,// other regexes are simpler and cover probably 99% of actual tags.'G1':/\{\{\s*(db-|csd[-:])?(nonsense|ns|g1)\s*\}\}/i,'G2':/\{\{\s*(db-|csd[-:])?(test|g2)\s*\}\}/i,'G3':/\{\{\s*(db-|csd[-:])?(vandalism|vandal|vand|g3)\s*\}\}/i,'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,// G9 is for office, there is no tag.// G10 is covered above'G11':/\{\{\s*(db-|csd[-:])?(spam|ad|advert|g11)\s*\}\}/i,'G12':/\{\{\s*(db-|csd[-:])?(copyvio|cv|cvio|g12|a8)\s*(\}\}|\|)/i,'A1':/\{\{\s*(db-|csd[-:])?((no)?context|a1)\s*\}\}/i,'A2':/\{\{\s*(db-|csd[-:])?(foreign|a2)\s*\}\}/i,'A3':/\{\{\s*(db-|csd[-:])?((no)?content|a3|contact|a4)\s*\}\}/i,// A4 = A3'A5':/\{\{\s*(db-|csd[-:])?(transwiki|a5)\s*\}\}/i,// A6 = G10'A7 (bio)':/\{\{\s*(nn-|db-|csd[-:])?(a7|notability|bio|person)\s*\}\}/i,'A7 (web)':/\{\{\s*(nn-|db-|csd[-:])?(web(site)?|inter(net|tubes))\s*\}\}/i,'A7 (group)':/\{\{\s*(db-|csd[-:]|nn-)?(band|club|music|inc|corp|comp(any)?)\s*\}\}/i,// TODO separate for music/band?// A8 = G12'A9':/\{\{\s*(db-|csd[-:]|nn-)?(a9|album)\s*\}\}/i,'C1':/(\{\{\s*(db-|csd[-:])?(catempty|emptycat|c1)\s*\}\}|empty category)/i,'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'R2':/\{\{\s*(db-|csd[-:])?(rediruser|r2)\s*\}\}/i,'R3':/\{\{\s*(db-|csd[-:])?(redirtypo|r3)\s*\}\}/i,'dummy':/this will never be reached, it is there to allow every entry above to end in a comma/}for(varcategoryinreasons_regex){if(reasons_regex[category].test(content)){varoption=findCSD(category);list.selectedIndex=option.index;break;}}document.getElementById('csdCheck').parentNode.removeChild(document.getElementById('csdCheck'));functionfindCSD(s){// s e.g. "U1", "G10"for(vari=0;i<list.options.length;i++){varo=list.options[i];if(o.text.indexOf("CSD "+s+":")==0)returno;if(o.text.indexOf(s+":")==0)returno;//TODO fine-tuning for A7 and G6}}}functionajaxPageContent(page){varpage_request=false;if(window.XMLHttpRequest)page_request=newXMLHttpRequest();elseif(window.ActiveXObject){try{page_request=newActiveXObject("Msxml2.XMLHTTP");}catch(e){try{page_request=newActiveXObject("Microsoft.XMLHTTP");}catch(e){}}}else{returnfalse;}varurl=wgServer+'/w/api.php';url=url+'?action=query&prop=revisions&titles='+page+'&rvlimit=1&rvprop=content&format=txtfm'page_request.onreadystatechange=function(){if(page_request.readyState==4){if(page_request.status==200){varpage_content=page_request.responseText;varpos=page_content.indexOf('[*] =>');page_content=page_content.substr(pos,250);ajaxDone(page_content);}else{document.getElementById('csdCheck').innerHTML='AJAX request failed.';returnfalse;}}}//page_request.overrideMimeType('text/xml');page_request.open('GET',url,true);page_request.send(null);}})();}