Jump to content

User:1234qwer1234qwer4/TfDstarted.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.
// This script adds an "TfDs Today" link to the top toolbar that gives the list of TfDs opened today, adapted from [[User:Lourdes/AfDstarted.js]]
 
$.when( mw.loader.using( ['mediawiki.util'] ), $.ready ).done( function() {
  function englishMonthName(month){
    switch(month)
    {
      case 0: return 'January';
      case 1: return 'February';
      case 2: return 'March';
      case 3: return 'April';
      case 4: return 'May';
      case 5: return 'June';
      case 6: return 'July';
      case 7: return 'August';
      case 8: return 'September';
      case 9: return 'October';
      case 10: return 'November';
      case 11: return 'December';
      default: return;
    }
  }
  var d = new Date();
  mw.util.addPortletLink(
    'p-personal',
    mw.util.getUrl('Wikipedia:Templates for discussion/Log/' + d.getUTCFullYear() + ' ' + englishMonthName(d.getUTCMonth()) + ' ' + d.getUTCDate()),
    'TfDs Today',
    'pt-specialnew',
    'View the TfD discussions that have been opened today',
    null,
    '#pt-preferences'
  );
});