User:Rcsprinter123/motdtools.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. |
Documentation for this user script can be added at User:Rcsprinter123/motdtools. |
///////////////////////////////////////////////////////////////////////////////////////////////////////////
//Created by [[User:Magnus animum]] to make MOTD maintenance work more easy. //
//Edited by: Hi878 and Smaug123 //
///////////////////////////////////////////////////////////////////////////////////////////////////////////
function closeapprovednom() {
reason = prompt("Why? Explain using the points that people made in their comments.");
which = prompt("Which version?");
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" + ":" + "{" + "{" + "Approved" + "}" + "} - " + "'''" + which + "'''" + " for " + "[[Wikipedia:Motto of the day/" + day + ", " + year + "|" + day + ", " + year + "]]. " + reason + " ~\~\~\~";
document.editform.wpSummary.value = document.editform.wpSummary.value + "Closing. Result was: Approved. ([[User:Rcsprinter123/motdtools.js|MotD Tools]])";
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? Explain using the points that people made in their comments.");
document.editform.wpTextbox1.value += "\n" + ":" + "{" + "{" + "Declined" + "}" + "} - " + reason + " ~\~\~\~";
document.editform.wpSummary.value = document.editform.wpSummary.value + "Closing. Result was: Declined. ([[User:Rcsprinter123/motdtools.js|MotD Tools]])";
document.editform.wpMinoredit.checked = false;
}
function closethrownnom() {
reason = prompt("Why? Note: This should only be used when the nomination is withdrawn, it was used on another day, or it obviously won't work.");
document.editform.wpTextbox1.value += "\n" + ":" + "{" + "{" + "Thrown out" + "}" + "} - " + reason + " ~\~\~\~";
document.editform.wpSummary.value = document.editform.wpSummary.value + "Closing. Result was: Thrown out. ([[User:Rcsprinter123/motdtools.js|MotD Tools]])";
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() {
reason = prompt("Why? Be very clear in your reasoning. Point out specific points that still need to be addressed before consensus can be reached.");
document.editform.wpTextbox1.value += "\n" + ":" + "{" + "{" + "Reopened" + "}" + "} - " + reason + " ~\~\~\~";
document.editform.wpSummary.value = document.editform.wpSummary.value + "Reopened nomination. ([[User:Rcsprinter123/motdtools.js|MotD Tools]])";
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 + ". ([[User:Rcsprinter123/motdtools.js|MotD Tools]])";
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 all appropriate wikilinks.");
where = prompt("Where did this nomination come from? Leave blank if you made it up.");
reason = prompt("Why are you nominating it?");
var commentStr = "<!-- ADD NEW AND REOPENED NOMINATIONS DIRECTLY BELOW THIS LINE. --><hr />"
var posOfComment = document.editform.wpTextbox1.value.search(commentStr);
var nomstr;
if (where == null)
{
nomstr = "===" + nomination + "===\n" + reason + " ~\~\~\~";
}
else
{
nomstr = "===" + "[" + "[" + where + "|→]" + "] " + nomination + "===\n" + reason + " ~\~\~\~";
}
if (posOfComment >= 0)
{
document.editform.wpTextbox1.value = insertStrAtPos(posOfComment+commentStr.length, nomstr)
}
else
{
document.editform.wpTextbox1.value = nomstr + document.editform.wpTextbox1.value;
}
document.editform.wpSummary.value = document.editform.wpSummary.value + "New nomination. ([[User:Rcsprinter123/motdtools.js|MotD Tools]])";
document.editform.wpMinoredit.checked = false;
}
function nomnomtab() {
mw.util.addPortletLink( 'p-cactions', "javascript:nomnom()", "Nominate", "ca-nominate", "Nominate", "Nominate");
}
$( function() {
if(document.title.indexOf("Editing Wikipedia:Motto of the day/Nominations") != -1) {
var commentStr = "<!-- ADD NEW AND REOPENED NOMINATIONS DIRECTLY BELOW THIS LINE. --><hr />"
var posOfComment = document.editform.wpTextbox1.value.search(commentStr);
if (posOfComment <= -1)
{
addOnloadHook(closeapprovednomtab);
addOnloadHook(closedeclinednomtab);
addOnloadHook(reopenednomtab);
addOnloadHook(closethrownnomtab);
addOnloadHook(commenttab);
}
addOnloadHook(nomnomtab);
}
});