User:Smaug123/motdArchive.js
Appearance
(Redirected from User:Smaug123/MOTDscript.js)
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:Smaug123/motdArchive. |
///////////////////////////////////////////////////////////////////////////////////////////////////////////
//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() {
mw.util.addPortletLink( 'p-cactions', "javascript:closeapprovednom()", "Approve", "ca-close approved nom", "Approve", "Approve");
}
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() {
mw.util.addPortletLink( 'p-cactions', "javascript:closedeclinednom()", "Decline", "ca-close declined nom", "Decline", "Decline");
}
function closethrownnomtab() {
mw.util.addPortletLink( 'p-cactions', "javascript:closethrownnom()", "Throw", "ca-close thrown nom", "Throw", "Throw");
}
function reopennom() {
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() {
mw.util.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() {
mw.util.addPortletLink( 'p-cactions', "javascript:comment()", "Comment", "ca-comment", "Comment", "Comment");
}
function insertStrAtPos(pos, newstr)
{
var result = document.editform.wpTextbox1.value.slice(0,pos) + "\n"+ newstr + document.editform.wpTextbox1.value.slice(pos,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 + "===\n" + reason + " --~\~\~\~";
if (posOfComment >= 0)
{
//at this point, we are editing the In Review section
document.editform.wpTextbox1.value = insertStrAtPos(posOfComment+commentStr.length, 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() {
mw.util.addPortletLink( 'p-cactions', "javascript:nomnom()", "Nominate", "ca-nominate", "Nominate", "Nominate");
}
addOnloadHook( function() {
var commentStr = "<!-- ADD NEW AND REOPENED NOMINATIONS DIRECTLY BELOW THIS LINE. --><hr />"
var posOfComment = document.editform.wpTextbox1.value.search(commentStr);
if ((document.title.indexOf("Editing Wikipedia:Motto of the day/Nominations") != -1) && (posOfComment <= -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);
}
});