User:Nishkid64/DYK/monobook.js

From Wikipedia, the free encyclopedia

If a message on your talk page led you here, please be wary of who left it. The code below could contain malicious content capable of compromising your account; if your account appears to be compromised, it will be blocked. If you are unsure whether the code is safe, you can ask at the appropriate village pump.
Note: After saving, you have to bypass your browser's cache to see the changes. In Internet Explorer and Firefox, hold down the Ctrl key and click the Refresh or Reload button. Opera users have to clear their caches through Tools→Preferences, see the instructions for Opera. Konqueror and Safari users can just click the Reload button.
// <nowiki> 
//automate insertion of the following functions:
// Article talk page: {{subst:dyktalk|10 June|2006}}
// Article creator's talk page: {{subst:UpdatedDYK|[[Article name]]}}
// Nominator's talk page: {{subst:UpdatedDYKNom|[[Article name]]}}
 
function pipe_date()
{
  var months = new Array('January', 'February', 'March', 'April', 'May', 'June',
                         'July', 'August', 'September', 'October', 'November', 'December');
  var date = new Date();
  var yearStr = date.getUTCFullYear();
  var dayMoStr = months[date.getUTCMonth()] +" "+ date.getUTCDate();
  var t = dayMoStr+"|"+yearStr;
  return t;
}
 
function dyk_talk()
{
 
  var f = document.editform, t = f.wpTextbox1;
  if (t.value.length > 0)
    t.value += '\n';
  t.value += "{{subst:dyktalk|"+pipe_date()+"}}  ~~~~";
  f.wpSummary.value = "This article was selected for [[WP:DYK|]]!" 
 
}
 
function updated_dyk()
{
  var page = prompt("User created which article?")
  var f = document.editform, t = f.wpTextbox1;
  if (t.value.length > 0)
    t.value += '\n';
  t.value += "{{subst:UpdatedDYK|"+pipe_date()+"|" + page + "}} \nThanks for your contributions! ~~~~";
  f.wpSummary.value = "Your  article, ''[[" + page + "]]'', was selected for [[WP:DYK|]]!" 
}
 
function updated_dyk_nom()
{
  var page = prompt("User nominated which article?")
  var f = document.editform, t = f.wpTextbox1;
  if (t.value.length > 0)
    t.value += '\n';
  t.value += "{{subst:UpdatedDYKNom|"+pipe_date()+"|" + page + "}} \nThanks for your contributions! ~~~~";
  f.wpSummary.value = "Your [[WP:DYK|]] nomination for [[" + page + "]] was successful" 
}
 
// end of file </nowiki>