Steam group ban

Ban members from group management page

目前為 2020-12-17 提交的版本,檢視 最新版本

  1. // ==UserScript==
  2. // @name Steam group ban
  3. // @namespace https://gf.qytechs.cn/users/2205
  4. // @version 0.1
  5. // @description Ban members from group management page
  6. // @author Ryzhehvost
  7. // @match https://steamcommunity.com/groups/*/membersManage*
  8. // @grant none
  9. // ==/UserScript==
  10.  
  11. (function() {
  12. 'use strict';
  13.  
  14. function getPartner(str) {
  15. if (typeof(BigInt)!=="undefined") {
  16. return (BigInt(str) % BigInt(4294967296)).toString(); // eslint-disable-line
  17. } else {
  18. let result = 0;
  19. for (let i = 0; i < str.length; i++) {
  20. result = (result * 10 + Number(str[i])) % 4294967296;
  21. }
  22. return result;
  23. }
  24. }
  25.  
  26. function banMember(steamid,username) {
  27. let gid = getPartner(g_strBaseEditURL.split("=")[1]); // eslint-disable-line
  28.  
  29. let xhr = new XMLHttpRequest();
  30. xhr.open("POST", "https://steamcommunity.com/gid/"+gid+"/banuser/?ajax=1", true);
  31. xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8");
  32. xhr.responseType = "json";
  33. xhr.onload = function() {
  34. console.log(xhr);
  35. let status = xhr.status;
  36. if (status === 200) {
  37. if (typeof(xhr.response) !== "undefined") {
  38. console.log(xhr.response);
  39. ShowAlertDialog("Banned Successfully", "User "+ username + " was banned from " + document.title.split("::")[2].trim()); // eslint-disable-line
  40. }
  41. } else {
  42. console.log("error");
  43. }
  44. };
  45. xhr.onerror = function() {
  46. console.log("error");
  47. }
  48. xhr.send("gidforum=-1&gidtopic=-1&gidcomment=-1&target="+getPartner(steamid)+"&sessionid="+g_sessionID+"&is_warning=0&ban_length=0&ban_reason=PERMABAN&deletecomments=on"); // eslint-disable-line
  49. //xhr.send("sessionID="+g_sessionID+"&steamid="+steamid+"&block=1");
  50. };
  51.  
  52. function BanEventHandler(event) {
  53. banMember(event.target.dataset.steamid,event.target.dataset.username);
  54. }
  55.  
  56. function updateButtons(elements){
  57. let kickbuttons = elements.getElementsByClassName("officerIcon manageMemberAction");
  58. const regex = /ManageMembers_Kick\(\s*'(\d+)',\s*'(.+)'\s\);/;
  59. for (let index=0; index<kickbuttons.length; index++) {
  60. let results = kickbuttons[index].outerHTML.match(regex);
  61. if (results!==null){
  62. let buttonDiv = document.createElement("div");
  63. buttonDiv.setAttribute("class", "manageMemberAction");
  64. buttonDiv.setAttribute("style", "display: inline-block;background-color: rgba( 0, 0, 0, 0.4 );border-radius: 9px;width: 21px;line-height: 21px;margin-right: 3px;vertical-align: middle;");
  65. buttonDiv.setAttribute("data-steamid", results[1]);
  66. buttonDiv.setAttribute("data-username", results[2]);
  67. buttonDiv.appendChild(document.createTextNode("⛔"));
  68. let insertedNode = kickbuttons[index].parentElement.insertBefore(buttonDiv, kickbuttons[index]);
  69. console.log(results);
  70. insertedNode.addEventListener("click", BanEventHandler);
  71. }
  72. }
  73. }
  74.  
  75. updateButtons(document.documentElement);
  76. })();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址