Jump to content

User:Kayau/motdclosure.js

From Wikipedia, the free encyclopedia
Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.
///////////////////////////////////////////////////////////////////////////////////////////////////////////
//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                                                                                                                                                                    //
///////////////////////////////////////////////////////////////////////////////////////////////////////////
function closemottonom() {
  result = prompt("What was the result?");
  reason = prompt("Why?");
  document.editform.wpTextbox1.value = document.editform.wpTextbox1.value += "\n" + ":" + "{" + "{" + result + "}" + "}" + " " + reason + ". " + "~" + "~" + "~" + "~";
  document.editform.wpSummary.value = document.editform.wpSummary.value + "Closing. Result was " + result + " " + reason + ".";
  document.editform.wpMinoredit.checked = false;
}
 
function closemottotab() {
  mw.util.addPortletLink( 'p-cactions', "javascript:closemottonom()", "close nom", "ca-close nom", "close nom", "close nom");
}
 
$(function() {
  if (document.title.indexOf("Editing Wikipedia:Motto of the day/Nominations") != -1 && document.title.indexOf("\(section\)") != -1) {
  addOnloadHook(closemottotab);
  }
});