User:343TheGuiltyProphet/ChatBlockButton.js

//ChatBlockButton script. Credits to Ozuzanna //Blocks a user then kicks them in chat. As always must be admin to block or it doesn't work. //It assumes that you do not want the user to be able to //create accounts or edit their talk page/message wall. //@Author Ozuzanna $('#Write').append('Block'); $("#chat-block-user").click(function {    var userToBlock = prompt('Please state the name of the user','Default');    var blockExpiry = prompt('Please state the block duration','indefinite');    var blockReason = prompt('Please state the block reason','Abusing multiple accounts');        $.ajax({ url: "/api.php", type: "POST", dataType: "JSON", data: { action: "block", user: userToBlock, expiry: blockExpiry, reason: blockReason, nocreate: 0, autoblock: 0, format: "json", token: mw.user.tokens.values.editToken },           success: function (d) { if (!d.error) { mainRoom.kick({name: userToBlock}); alert("Request successful!"); } else { alert("Request failed: " + d.error.code); }           },            error: function  { alert("Request failed!"); }       }); });