// По мотивам http://en.wikipedia.org/wiki/User:Mr.Z-man/refbuttons.js
// CC-BY-SA

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': '//upload.wikimedia.org/wikipedia/commons/9/91/Button_cite_web.png',
            'speedTip': 'cite web',
            'tagOpen': '<ref>{{cite web\n|author=\n|authorlink=\n|datepublished=\n|url=\n|title=\n|format=\n|work=\n|publisher=\n|accessdate=' + nowyear + '-' + nowmonth + '-' + nowday + '\n|lang=\n|description=\n}}',
            'tagClose': '</ref>',
            'sampleText': ''
        };

        mwCustomEditButtons[mwCustomEditButtons.length] = {
            'imageFile': '//upload.wikimedia.org/wikipedia/commons/2/2c/Button_cite_news.png',
            'speedTip': 'cite news',
            'tagOpen': '<ref>{{cite news\n|author=\n|title=\n|url=\n|work=\n|publisher=\n|date=\n|accessdate=' + nowyear + '-' + nowmonth + '-' + nowday + '\n}}',
            'tagClose': '</ref>',
            'sampleText': ''
        };

        mwCustomEditButtons[mwCustomEditButtons.length] = {
            'imageFile': '//upload.wikimedia.org/wikipedia/commons/e/ef/Button_cite_book.png',
            'speedTip': 'книга',
            'tagOpen': '<ref>{{книга\n|автор=\n|заглавие=\n|ответственный=\n|ссылка=\n|место=\n|издательство=\n|год=\n|том=\n|страниц=\n|страницы=\n|isbn=\n}}',
            'tagClose': '</ref>',
            'sampleText': ''
        };
    }
}

$( refbuttons );