User:Quarl/autowarn.js

From Wikipedia, the free encyclopedia

This is an old revision of this page, as edited by Quarl (talk | contribs) at 06:05, 4 January 2006. The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

Jump to navigation Jump to search
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.
// based on http://en.wikipedia.org/wiki/Wikipedia:WikiProject_User_scripts/Scripts/test-n.js

// <pre>

function testn(number)
{
  var page = prompt("Vandalism to which article?")
  var f = document.editform, t = f.wpTextbox1;
  if (t.value.length > 0)
    t.value += '\n';
  t.value += "{{subst:" + "test" + number + "-n|" + page + "}} ~" + "~" + "~" + "~";
  f.wpSummary.value = "Vandalism to [[" + page + "]] - warning " + number;
}

function add_testn_tabs()
{
  // Only add for pages with "Editing User talk:" somewhere in the title
  if (document.title.indexOf("Editing User talk:") != -1) {
      var tabs = getTabActions();
      for (var i = 1; i <= 4; ++i) 
          addlilink(tabs,'javascript:testn('+i+')',"t"+i,'testn'+i,'Vandalism warning '+i);
  }
}

addOnloadHook(add_testn_tabs);

//

// </pre>