// [[Category:Gadgets|Blocktab.js]]
jQuery(document).ready(function ($) {
const lang = mw.config.get('wgUserLanguage');
const ns = mw.config.get('wgNamespaceNumber');
if (ns !== 2 && ns !== 3) return;
const msgBlockLabel = {
en: 'Block',
de: 'Sperren',
fr: 'Bloquer',
es: 'Bloquear',
pl: 'Zablokuj'
};
const msgBlockTooltip = {
en: 'Block "$1"',
pl: 'Zablokuj "$1"',
es: 'Bloquear "$1"',
fr: 'Bloquer "$1"',
de: 'Sperre "$1"'
};
const userLang = lang in msgBlockLabel ? lang : 'en';
mw.messages.set({
'gadget-blocktab-label': msgBlockLabel[userLang],
'gadget-blocktab-tooltip': msgBlockTooltip[userLang]
});
let title = mw.config.get('wgTitle').split('/')[0];
mw.util.addPortletLink(
'p-cactions',
mw.util.getUrl('Special:Block/' + title),
mw.msg('gadget-blocktab-label'),
't-block',
mw.msg('gadget-blocktab-tooltip', title)
);
});