Jump to content

User:Mr.Z-man/refbuttons.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.
// For description, see [[User:Mr.Z-man/refbuttons]]

function refbuttons() {
 if (typeof mwCustomEditButtons !== 'undefined') {

    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=" + nowyear + "-" + nowmonth + "-" + nowday + " |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=" + nowyear + "-" + nowmonth + "-" + nowday,
     "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": ""};
  }
}
$(refbuttons);