User:Borschts/block.js

$(mw.util.addPortletLink('p-cactions', '#', '一鍵封禁', 'p-onekeyblock')).click(function (e) {   e.preventDefault;    var username = prompt('請輸入想封禁的用戶. ');   if (username) {        $.ajax({ url: mw.util.wikiScript('api'), data: { format: 'json', action: 'block', user: username, expiry: 'never', reason: 'by 濫權封禁. ', nocreate: true, autoblock: true, noemail: true, reblock: true, token: mw.user.tokens.get('editToken'), },           dataType: 'json', type: 'POST', success: function (data) { alert('OK'); },           error: function (xhr) { alert('Error'); }       });    } });