MediaWiki:DeleteTalkpage.js

mw.hook('dev.i18n').add(function (i18no) {   i18no.loadMessages('DeleteTalkpage').done(function (i18n) { if (mw.config.get('wgAction') === 'delete' && /14|4|6|12|6|8828|2|0/.test(mw.config.get('wgNamespaceNumber')) && window.DeleteTalkpageLoaded) { window.DeleteTalkpageLoaded = true; new mw.Api.get({               action: 'query',                format: 'json',                prop: 'info',                titles: mw.config.get('wgPageName'),                inprop: 'talkid'            }).done(function (d) {                var q = d.query.pages[mw.config.get('wgArticleId')];                if (!q.talkid) {                    return;                }                $('#wpDeleteReasonRow').after( $(' ')                       .append('  ') .append(' ', {                           class: 'mw-input'                        }) .append(' ', {                               name: 'wpTalkDelete',                                type: 'checkbox',                                value: '1',                                id: 'wpTalkDelete',                                tabindex: '3'                            }) .append(' ') .append(' ', {                                   for: 'wpTalkDelete',                                    text: i18n.msg('label').parse                                }) );               var params = {                    action: 'delete',                    format: 'json',                    pageid: q.talkid,                    reason: i18n.msg('reason').plain,                    token: mw.user.tokens.get('editToken')                };                if ($('#wpWatch').attr('checked')) {                    params.watchlist = 'watch';                }                $('#wpConfirmB').click(function  { if ($('#wpTalkDelete').attr('checked')) { new mw.Api.post(params); }               });            });        }    }); }); importArticle({    type: 'script',    article: 'u:dev:MediaWiki:I18n-js/code.js' });