Wikipedia:WikiProject User scripts/Scripts/CloseRFA.js
Appearance
// <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 INCOMPLETE
function autoRFA_result() {
var close = prompt("Result of debate?");
if (close != null && close != "") {
var noncrat = " ([[Wikipedia:Non-crat closure|non-crat closure]])";
if (typeof mw.config.get('wgUserGroups') == "object" && mw.config.get('wgUserGroups')) {
for ( var g = 0; g < mw.config.get('wgUserGroups').length; ++g ) {
if ( mw.config.get('wgUserGroups')[g] == "crat" ) {
noncrat = "";
break;
}
}
}
var f = 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;
}
}
function autorfa_pass() {
var date = prompt("Nomination was made when?");
if (date != null && date != "") {
var votepage = prompt("Vote page is? (Enter 'd' for default.)");
if (votepage != null && votepage != "") {
var f = document.editform, t = f.wpTextbox1;
// If default votepage...
if (votepage=="d") {
var temp = document.editform.action.split("/w/index.php?title=");
var temp = temp[1].split("&action=submit");
var temp = temp[0].substring(5);
var votepage = temp;
}
t.value = "{"+"{oldafdfull|date=" + date + "|votepage=" + votepage + "}}" + '\n' + '\n' + t.value;
var nonadmin = " ([[Wikipedia:Non-admin closure|non-admin closure]])";
if (typeof mw.config.get('wgUserGroups') == "object" && mw.config.get('wgUserGroups')) {
for ( var g = 0; g < mw.config.get('wgUserGroups').length; ++g ) {
if ( mw.config.get('wgUserGroups')[g] == "sysop" ) {
nonadmin = "";
break;
}
}
}
f.wpSummary.value = "Article survived AfD" + nonadmin;
}
}
}
function autorfa_WP:SNOW_close() {
var date = prompt("Nomination was made when?");
if (date != null && date != "") {
var votepage = prompt("Vote page is? (Enter 'd' for default.)")
if (votepage != null && votepage != "") {
var f = document.editform, t = f.wpTextbox1;
// If default votepage...
if (votepage=="d") {
var temp = document.editform.action.split("/w/index.php?title=");
var temp = temp[1].split("&action=submit");
var temp = temp[0].substring(5);
var votepage = temp;
}
t.value = "{"+"{oldafdfull|date=" + date + "|result='''no consensus'''|votepage=" + votepage + "}}" + '\n' + '\n' + t.value;
f.wpSummary.value = "Article survived AfD with no consensus";
}
}
}
function autoafd_WP:NOTNOW_close() {
var date = prompt("Nomination was made when?");
if (date != null && date != "") {
var redirect = prompt("Redirect to?");
if (redirect != null && redirect != "") {
var votepage = prompt("Vote page is? (Enter 'd' for default.)");
if (votepage != null && votepage != "") {
var f = document.editform, t = f.wpTextbox1;
// If default votepage...
if (votepage=="d") {
var temp = document.editform.action.split("/w/index.php?title=");
var temp = temp[1].split("&action=submit");
var temp = temp[0].substring(5);
var votepage = temp;
}
t.value = "{"+"{oldafdfull|date=" + date + "|result='''redirect to [[" + redirect + "]]'''|votepage=" + votepage + "}}" + '\n' + '\n' + t.value;
var nonadmin = " ([[Wikipedia:Non-admin closure|non-admin closure]])";
if (typeof mw.config.get('wgUserGroups') == "object" && mw.config.get('wgUserGroups')) {
for ( var g = 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;
}
}
}
}
function autoafd_fail() {
var date = prompt("Nomination was made when?");
if (date != null && date != "") {
var redirect = prompt("Merge and redirect to?");
if (redirect != null && redirect != "") {
var votepage = prompt("Vote page is? (Enter 'd' for default.)");
if (redirect != null && redirect != "") {
var f = document.editform, t = f.wpTextbox1;
// If default votepage...
if (votepage=="d") {
var temp = document.editform.action.split("/w/index.php?title=");
var temp = temp[1].split("&action=submit");
var temp = temp[0].substring(5);
var votepage = 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";
}
}
}
}
function autoafd_no_consensus() {
var date = prompt("Nomination was made when?");
if (date != null && date != "") {
var result = prompt("Result was?");
if (result != null && result != "") {
var votepage = prompt("Vote page is? (Enter 'd' for default.)");
if (votepage != null && votepage != "") {
var f = document.editform, t = f.wpTextbox1;
// If default votepage...
if (votepage=="d") {
var temp = document.editform.action.split("/w/index.php?title=");
var temp = temp[1].split("&action=submit");
var temp = temp[0].substring(5);
var votepage = temp;
}
t.value = "{"+"{oldafdfull|date=" + date + "|result='''" + result + "'''|votepage=" + votepage + "}}" + '\n' + '\n' + t.value;
var nonadmin = " ([[Wikipedia:Non-admin closure|non-admin closure]])";
if (typeof mw.config.get('wgUserGroups') == "object" && mw.config.get('wgUserGroups')) {
for ( var g = 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;
}
}
}
}
function autoafd_add_afd_tabs() {
// Only add for pages with the right string somewhere in the title
if (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>