User:Prince(ss) Platinum/ChatBlock.js

function BlockUser { var delAllUser = prompt('Please state the user to block'); var blockExpiry = prompt('Please state the block duration','2 weeks'); var blockReason = prompt('Please state the block reason','vandalism'); var url = wgServer+'/api.php?action=query&prop=info&intoken=block&titles=User:'+delAllUser+'&format=json'; $.getJSON(url, function(data) { if (!blockExpiry || !blockReason) return; var p; for (var p in data.query.pages) { break; }; var ET = data.query.pages[p].blocktoken; var ET = ET.slice(0, -2); var ET = ET+'%2B\\'; var url = wgServer+'/api.php?action=block&user='+delAllUser+'&expiry='+blockExpiry+'&reason='+blockReason+'&nocreate&autoblock&noemail&format=json&token='+ET; $.post(url, function { alert('User has been blocked');});});}