User:PeterSymonds/reftools.js

From Wikiquote

Note: After publishing, you may have to bypass your browser's cache to see the changes.

  • Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
  • Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
  • Internet Explorer / Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5
  • Opera: Press Ctrl-F5.
// For description, see [[User:Mr.Z-man/refbuttons]]. Lifted from Mr.Z-man on the English Wikipedia.

function refbuttons() {
 if (mwCustomEditButtons) {

    var time = new Date();
    var curday = time.getDate();
    var curmonth = time.getMonth()+1;
    var nowyear = time.getYear()+1900;
    var nowday = curday.toString();
    if (curday <10) { nowday = "0"+nowday;}
    var nowmonth = curmonth.toString();
    if (curmonth <10) { nowmonth = "0"+nowmonth;}

   mwCustomEditButtons[mwCustomEditButtons.length] = {
     "imageFile": "http://upload.wikimedia.org/wikipedia/commons/9/91/Button_cite_web.png",
     "speedTip": "Web citation",
     "tagOpen": "<ref>{{cite web |url= |title= |accessdate=" + November + nowday + " |accessyear=" + nowyear + " |last= |first= |coauthors= |date= |work= |publisher=",
     "tagClose": "}}</ref>",
     "sampleText": ""};

   mwCustomEditButtons[mwCustomEditButtons.length] = {
     "imageFile": "http://upload.wikimedia.org/wikipedia/commons/2/2c/Button_cite_news.png",
     "speedTip": "News citation",
     "tagOpen": "<ref>{{cite news |first= |last= |authorlink= |coauthors= |title= |url= |work= |publisher= |date= |accessdate=" + nowday + "-" + nowmonth + "-" + nowyear,
     "tagClose": "}}</ref>",
     "sampleText": ""};

   mwCustomEditButtons[mwCustomEditButtons.length] = {
     "imageFile": "http://upload.wikimedia.org/wikipedia/commons/e/ef/Button_cite_book.png",
     "speedTip": "Book citation",
     "tagOpen": "<ref>{{cite book |title= |last= |first= |authorlink= |coauthors= |year= |publisher= |location= |isbn=",
     "tagClose": "}}</ref>",
     "sampleText": ""};
  }
}
addOnloadHook(refbuttons);