Wikipedia:WikiProject User scripts/Scripts/CloseRFA.js
// <syntaxhighlight lang="javascript">//this helps automate RFA closing by adding a 'close' tab to RFA debates, based off the//[[Wikipedia:WikiProject_User_scripts/Scripts/CloseRFA.js]] script//written by [[User:Ktr101]] based on [[Wikipedia:WikiProject User scripts/Scripts/test-n.js]] by [[User:Celestianpower]]//THIS SCRIPT IS INCOMPLETEfunctionautoRFA_result(){varclose=prompt("Result of debate?");if(close!=null&&close!=""){varnoncrat=" ([[Wikipedia:Non-crat closure|non-crat closure]])";if(typeofmw.config.get('wgUserGroups')=="object"&&mw.config.get('wgUserGroups')){for(varg=0;g<mw.config.get('wgUserGroups').length;++g){if(mw.config.get('wgUserGroups')[g]=="crat"){noncrat="";break;}}}varf=document.editform,t=f.wpTextbox1;t.value=t.value.split('{'+'{REMOVE THIS TEMPLATE WHEN CLOSING THIS RFA').join('{'+'{ns:0');t.value="{"+"{subst:"+"at"+"}} '''"+close+"'''."+nonadmin+" "+"~"+"~"+"~"+"~"+'\n'+'\n'+t.value;if(t.value.length>0){t.value+='\n';}t.value+="{"+"{subst:"+"ab"+"}}";f.wpSummary.value="Closing debate; result was "+close+noncrat;}}functionautorfa_pass(){vardate=prompt("Nomination was made when?");if(date!=null&&date!=""){varvotepage=prompt("Vote page is? (Enter 'd' for default.)");if(votepage!=null&&votepage!=""){varf=document.editform,t=f.wpTextbox1;// If default votepage...if(votepage=="d"){vartemp=document.editform.action.split("/w/index.php?title=");vartemp=temp[1].split("&action=submit");vartemp=temp[0].substring(5);varvotepage=temp;}t.value="{"+"{oldafdfull|date="+date+"|votepage="+votepage+"}}"+'\n'+'\n'+t.value;varnonadmin=" ([[Wikipedia:Non-admin closure|non-admin closure]])";if(typeofmw.config.get('wgUserGroups')=="object"&&mw.config.get('wgUserGroups')){for(varg=0;g<mw.config.get('wgUserGroups').length;++g){if(mw.config.get('wgUserGroups')[g]=="sysop"){nonadmin="";break;}}}f.wpSummary.value="Article survived AfD"+nonadmin;}}}functionautorfa_WP:SNOW_close(){vardate=prompt("Nomination was made when?");if(date!=null&&date!=""){varvotepage=prompt("Vote page is? (Enter 'd' for default.)")if(votepage!=null&&votepage!=""){varf=document.editform,t=f.wpTextbox1;// If default votepage...if(votepage=="d"){vartemp=document.editform.action.split("/w/index.php?title=");vartemp=temp[1].split("&action=submit");vartemp=temp[0].substring(5);varvotepage=temp;}t.value="{"+"{oldafdfull|date="+date+"|result='''no consensus'''|votepage="+votepage+"}}"+'\n'+'\n'+t.value;f.wpSummary.value="Article survived AfD with no consensus";}}}functionautoafd_WP:NOTNOW_close(){vardate=prompt("Nomination was made when?");if(date!=null&&date!=""){varredirect=prompt("Redirect to?");if(redirect!=null&&redirect!=""){varvotepage=prompt("Vote page is? (Enter 'd' for default.)");if(votepage!=null&&votepage!=""){varf=document.editform,t=f.wpTextbox1;// If default votepage...if(votepage=="d"){vartemp=document.editform.action.split("/w/index.php?title=");vartemp=temp[1].split("&action=submit");vartemp=temp[0].substring(5);varvotepage=temp;}t.value="{"+"{oldafdfull|date="+date+"|result='''redirect to [["+redirect+"]]'''|votepage="+votepage+"}}"+'\n'+'\n'+t.value;varnonadmin=" ([[Wikipedia:Non-admin closure|non-admin closure]])";if(typeofmw.config.get('wgUserGroups')=="object"&&mw.config.get('wgUserGroups')){for(varg=0;g<mw.config.get('wgUserGroups').length;++g){if(mw.config.get('wgUserGroups')[g]=="sysop"){nonadmin="";break;}}}f.wpSummary.value="Article redirected to [["+redirect+"]] as per AfD"+nonadmin;}}}}functionautoafd_fail(){vardate=prompt("Nomination was made when?");if(date!=null&&date!=""){varredirect=prompt("Merge and redirect to?");if(redirect!=null&&redirect!=""){varvotepage=prompt("Vote page is? (Enter 'd' for default.)");if(redirect!=null&&redirect!=""){varf=document.editform,t=f.wpTextbox1;// If default votepage...if(votepage=="d"){vartemp=document.editform.action.split("/w/index.php?title=");vartemp=temp[1].split("&action=submit");vartemp=temp[0].substring(5);varvotepage=temp;}t.value="{"+"{oldafdfull|date="+date+"|result='''merge and redirect to [["+redirect+"]]'''|votepage="+votepage+"}}"+'\n'+'\n'+t.value;f.wpSummary.value="Article merged and redirected to [["+redirect+"]] as per AfD";}}}}functionautoafd_no_consensus(){vardate=prompt("Nomination was made when?");if(date!=null&&date!=""){varresult=prompt("Result was?");if(result!=null&&result!=""){varvotepage=prompt("Vote page is? (Enter 'd' for default.)");if(votepage!=null&&votepage!=""){varf=document.editform,t=f.wpTextbox1;// If default votepage...if(votepage=="d"){vartemp=document.editform.action.split("/w/index.php?title=");vartemp=temp[1].split("&action=submit");vartemp=temp[0].substring(5);varvotepage=temp;}t.value="{"+"{oldafdfull|date="+date+"|result='''"+result+"'''|votepage="+votepage+"}}"+'\n'+'\n'+t.value;varnonadmin=" ([[Wikipedia:Non-admin closure|non-admin closure]])";if(typeofmw.config.get('wgUserGroups')=="object"&&mw.config.get('wgUserGroups')){for(varg=0;g<mw.config.get('wgUserGroups').length;++g){if(mw.config.get('wgUserGroups')[g]=="sysop"){nonadmin="";break;}}}f.wpSummary.value="AfDed; result was "+result+nonadmin;}}}}functionautoafd_add_afd_tabs(){// Only add for pages with the right string somewhere in the titleif(document.title.indexOf("Editing Wikipedia:Request for adminship/")!=-1){mw.util.addPortletLink('p-cactions','javascript:autorfa_result()',"close");mw.util.addPortletLink('p-cactions','javascript:autorfa_relist()',"relist");}if(document.title.indexOf("Editing Talk:")!=-1){mw.util.addPortletLink('p-cactions','javascript:autoafd_keep()',"keep");mw.util.addPortletLink('p-cactions','javascript:autoafd_no_consensus()',"no consensus");mw.util.addPortletLink('p-cactions','javascript:autoafd_redirect()',"redirect");mw.util.addPortletLink('p-cactions','javascript:autoafd_merge()',"merge");mw.util.addPortletLink('p-cactions','javascript:autoafd_other()',"other");}}$(autoafd_add_rfa_tabs);//end RFA closing script// </syntaxhighlight>