Jump to content

User:Jj137/CloseMFD.js

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Jj137 (talk | contribs) at 01:05, 12 January 2008 (create). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
(diff) ← Previous revision | Latest revision (diff) | Newer revision → (diff)
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.
// <pre>
//Helps automate MfD closes, written by [[User:Jj137]]
//original script written by [[User:Johnleemk]] based on [[Wikipedia:WikiProject User scripts/Scripts/test-n.js]] by [[User:Celestianpower]]

function automfd_result()
{
  var close = prompt("Result of debate?")
  var f = document.editform, t = f.wpTextbox1;
  t.value = "{{subst:" + "mt" + "}} '''" + close + "'''. " + "~" + "~" + "~" + "~" + '\n' + '\n' + t.value;
  if (t.value.length > 0)
    t.value += '\n';
  t.value += "{{subst:" + "mb" + "}}";
  f.wpSummary.value = "Closing debate; result was " + close;
}

function automfd_add_mfd_tabs()
{
  // Only add for pages with the right string somewhere in the title
  if (document.title.indexOf("Editing Wikipedia:Miscellany for deletion/") != -1)
    {
      addPortletLink('p-cactions', 'javascript:automfd_result()', "close");
    }
    }

addOnloadHook(autoafd_add_mfd_tabs);

//end MfD closing script

// </pre>