User:Hi878/Sandbox
Appearance
— Today's Motto of the Day
Hi878
User page · Talk page · Contributions (Alternate) · Edit count (Alternate) · E-mail Me · Sandbox · Awards03:55, 28 November 2011 (UTC)
///////////////////////////////////////////////////////////////////////////////////////////////////////////
//Created by [[User:Magnus animum]] to make MOTD maintenance work more easy. //
//Note: To close nominations using this script, it MUST be done section by section. If you want to mass //
//close, I suggest that you do it the old-fashioned way — manually typing the outcome of the nomination. //
//Edited by: Hi878 and Smaug123 //
///////////////////////////////////////////////////////////////////////////////////////////////////////////
function closeapprovednom() {
reason = prompt("Why?");
support = prompt("How many supports?");
oppose = prompt("How many opposes?");
day = prompt("List the month and date for which this is scheduled, format Month Day, eg. June 20");
year = prompt("Which year is it scheduled for?");
document.editform.wpTextbox1.value += "\n" + ":" + "{" + "{" + "subst:Appr|" + support + "|" + oppose + "|" + reason + "|" + day + "|" + year + "}" + "}";
document.editform.wpSummary.value = document.editform.wpSummary.value + "Closing. Result was: Approved - " + reason + ".";
document.editform.wpMinoredit.checked = false;
}
function closeapprovednomtab() {
addPortletLink( 'p-cactions', "javascript:closeapprovednom()", "Approve", "ca-close approved nom", "Approve", "Approve");
}
addOnloadHook(
function() {
if ((document.title.indexOf("Editing Wikipedia:Motto of the day/Nominations") != -1) && (document.title.indexOf("\(section\)") != -1))
{
addOnloadHook(closeapprovednomtab);
addOnloadHook(closedeclinednomtab);
addOnloadHook(reopenednomtab);
addOnloadHook(closethrownnomtab);
addOnloadHook(commenttab);
};
if ((document.title.indexOf("Editing Wikipedia:Motto of the day/Nominations") != -1)
{
addOnloadHook(nomnomtab);
}
}
)
function closedeclinednom() {
reason = prompt("Why?");
support = prompt("How many supports?");
oppose = prompt("How many opposes?");
document.editform.wpTextbox1.value += "\n" + ":" + "{" + "{" + "subst:Rej|" + support + "|" + oppose + "|" + reason + "}" + "}";
document.editform.wpSummary.value = document.editform.wpSummary.value + "Closing. Result was: Declined - " + reason + ".";
document.editform.wpMinoredit.checked = false;
}
function closethrownnom() {
reason = prompt("Why?");
support = prompt("How many supports?");
oppose = prompt("How many opposes?");
document.editform.wpTextbox1.value += "\n" + ":" + "{" + "{" + "subst:ThrowMotto|" + support + "|" + oppose + "|" + reason + "}" + "}";
document.editform.wpSummary.value = document.editform.wpSummary.value + "Closing. Result was: Thrown out - " + reason + ".";
document.editform.wpMinoredit.checked = false;
}
function closedeclinednomtab() {
addPortletLink( 'p-cactions', "javascript:closedeclinednom()", "Decline", "ca-close declined nom", "Decline", "Decline");
}
function closethrownnomtab() {
addPortletLink( 'p-cactions', "javascript:closethrownnom()", "Throw", "ca-close thrown nom", "Throw", "Throw");
}
function reopennom() {
document.editform.wpTextbox1.value = document.editform.wpTextbox1.value += "\n" + ":" + "{" + "{" + "subst:reopened" + "}" + "}" + " per lack of consensus. " + "~" + "~" + "~" + "~";
document.editform.wpSummary.value = document.editform.wpSummary.value + "Reopened per lack of consensus.";
document.editform.wpMinoredit.checked = false;
}
function reopenednomtab() {
addPortletLink( 'p-cactions', "javascript:reopennom()", "Reopen", "ca-reopen nom", "Reopen", "Reopen");
}
function comment() {
comment = prompt("What is your !vote?");
reason = prompt("Why?");
document.editform.wpTextbox1.value += "*\'\'\'" + comment + "\'\'\' - " + reason + " ~"+"~~"+"~";
document.editform.wpSummary.value = document.editform.wpSummary.value + comment + " - " + reason;
document.editform.wpMinoredit.checked = false;
}
function commenttab() {
addPortletLink( 'p-cactions', "javascript:comment()", "Comment", "ca-comment", "Comment", "Comment");
}
function insertStrAtPos(pos, newstr)
{
var result = document.editform.wpTextbox1.value.slice(0,pos) + newstr + document.editform.wpTextbox1.value.slice(pos+1,document.editform.wpTextbox1.value.length);
return result;
}
function nomnom() {
nomination = prompt("What is your nomination? Remember to include appropriate wikilinks.");
reason = prompt("Why?");
var commentStr = "<!-- ADD NEW AND REOPENED NOMINATIONS DIRECTLY BELOW THIS LINE. --><hr />"
var posOfComment = document.editform.wpTextbox1.value.search(commentStr);
var nomstr = "=\=\= " + nomination + " =\=\=" + "</br>" + reason + "~\~\~\~";
if (posOfComment >= 0)
{
//at this point, we are editing the In Review section
document.editform.wpTextbox1.value = insertStrAtPos(posOfComment, nomstr)
}
else
{
//we are editing in a subsection
document.editform.wpTextbox1.value = nomstr + document.editform.wpTextbox1.value;
}
document.editform.wpSummary.value = document.editform.wpSummary.value + "New nomination.";
document.editform.wpMinoredit.checked = false;
}
function nomnomtab() {
addPortletLink( 'p-cactions', "javascript:nomnom()", "Nominate", "ca-nominate", "Nominate", "Nominate");
}