User:TheSandDoctor/scripts/massblock.js

if(mw.config.get("wgPageName")==="Special:BlankPage/mass-block"){ $("#mw-content-text").empty .append("Usernames (one per line):") .append($(" ",{"rows":"8","cols":"100","id":"mass-block-users"})) .append(" ") .append("Reason: ") .append($(" ",{"type":"text","length":"256","id":"mass-block-reason"})) .append(" ") .append($(" ").text("Block all").click(function{ mw.loader.using(["mediawiki.api"],function{ var api = new mw.Api; var reason = $("#mass-block-reason").val; var users = $("#mass-block-users").val.split('\n'); console.log(users) for(var i = 0; i < users.length; i++) { new mw.Api.postWithToken("csrf",{ action: "block", user: users[i], expiry: "indefinite", reason: reason, anononly: true, // just because twinkle has it on nocreate: false, autoblock: false, noemail: false, allowusertalk: true }).then(function{console.log("Blocked " + users[i]);}).catch(function(e){console.error(e);}); }// end for loop }); // end mw.loader.using }));// end button click handler }