User:Mr.Z-man/closeAFD.js
Appearance
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. |
![]() | This user script seems to have a documentation page at User:Mr.Z-man/closeAFD. |
var closeAFD_default_close;
/*
function autoafd_result()
{
var close = prompt("Result of debate?", closeAFD_default_close)
if (close == null) {return;}
var reason = prompt("Additional reason:", "reason")
var page = "[["+wgPageName.replace(/_/g, "%20")+"]]";
var title = wgTitle.substring(wgTitle.indexOf('/')+1);
var f = document.editform, t = f.wpTextbox1;
t.value = t.value.replace(/{{REMOVE THIS TEMPLATE WHEN CLOSING THIS AfD\|(\w|\?)}}\n/i,"")
if (reason != "reason") {
t.value = "{{subst:" + "at" + "}} '''" + close + "'''. " + reason + " ~" + "~" + "~" + "~" + '\n' + t.value;
}
else {
t.value = "{{subst:" + "at" + "}} '''" + close + "'''. " + "~" + "~" + "~" + "~" + '\n' + t.value;
}
if (t.value.length > 0)
t.value += '\n';
t.value += "{{subst:" + "ab" + "}}";
f.wpSummary.value = "Closing debate; result was " + close;
document.editform.wpSave.click();
if (close == "delete") {
window.open("http://en.wikipedia.org/w/index.php?title="+title+"&action=delete&wpReason="+page+"&autodelete=true");
window.open("http://en.wikipedia.org/w/index.php?title=Talk:"+title+"&action=delete&wpReason="+page+"&autodelete=true");
}
}
function autoafd_relist()
{
var f = document.editform, t = f.wpTextbox1;
if (t.value.length > 0)
t.value += '\n';
t.value += "{{subst:" + "relist" + "|~" + "~" + "~" + "~}}";
f.wpSummary.value = "Relisting debate";
}
function autoafd_keep()
{
var date = prompt("Nomination was made when?")
var votepage = prompt("Vote page is? (Enter 'd' for default.)")
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;
f.wpSummary.value = "Article survived AfD";
}
function autoafd_no_consensus()
{
var date = prompt("Nomination was made when?")
var votepage = prompt("Vote page is? (Enter 'd' for default.)")
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_redirect()
{
var date = prompt("Nomination was made when?")
var redirect = prompt("Redirect to?")
var votepage = prompt("Vote page is? (Enter 'd' for default.)")
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;
f.wpSummary.value = "Article redirected to [[" + redirect + "]] as per AfD";
}
function autoafd_merge()
{
var date = prompt("Nomination was made when?")
var redirect = prompt("Merge and redirect to?")
var votepage = prompt("Vote page is? (Enter 'd' for default.)")
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_other()
{
var date = prompt("Nomination was made when?")
var result = prompt("Result was?")
var votepage = prompt("Vote page is? (Enter 'd' for default.)")
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;
f.wpSummary.value = "AfDed; result was " + result;
*/}
function AFDtest() {
closeAFD_getPageText(wgPageName);
}
function closeAFD_getPageText(title) {
var req = sajax_init_object();
req.open("GET", wgServer + wgScriptPath + "/api.php?action=query&prop=revisions&rvprop=content&format=json&titles="+title, false);
req.send(null);
var response = eval('(' + req.responseText + ')');
alert(response);
//return pagetext;
}
function closeAFD_getToken(title, type) {
var req = sajax_init_object();
req.open("GET", wgServer + wgScriptPath + "/api.php?action=query&prop=info&intoken="+type+"&format=json&titles="+title, false);
req.send(null);
var response = eval('(' + req.responseText + ')');
//return token;
}
function closeAFD_editPage(title, newtext, token, summary) {
var req = sajax_init_object();
req.open("POST", wgServer + wgScriptPath + "/api.php?action=edit&token="+token+"&title="+title+"&text="+newtext+"¬minor=1&summary="+summary+"&nocreate=1&, true);
req.send(null);
var response = eval('(' + req.responseText + ')');
//return token;
}