Steam group ban

Ban members from group management page

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         Steam group ban
// @namespace    https://greasyfork.org/users/2205
// @version      0.3
// @description  Ban members from group management page
// @author       Rudokhvist
// @match        https://steamcommunity.com/groups/*/membersManage*
// @license      Apache-2.0
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    function getPartner(str) {
        if (typeof(BigInt)!=="undefined") {
            return (BigInt(str) % BigInt(4294967296)).toString(); // eslint-disable-line
        } else {
            let result = 0;
            for (let i = 0; i < str.length; i++) {
                result = (result * 10 + Number(str[i])) % 4294967296;
            }
            return result;
        }
    }

    function BanEventHandler(event) {
        Forum_BanOrWarnUser(getPartner(g_strBaseEditURL.split("=")[1]), -1, -1, -1, getPartner(event.target.dataset.steamid), 0); // eslint-disable-line
    }

    function updateButtons(elements){
        let kickbuttons = elements.getElementsByClassName("officerIcon manageMemberAction");
        const regex = /ManageMembers_Kick\(\s*'(\d+)',\s*'(.+)'\s\);/;
        for (let index=0; index<kickbuttons.length; index++) {
            let results = kickbuttons[index].outerHTML.match(regex);
            if (results!==null){
                let buttonDiv = document.createElement("div");
                buttonDiv.setAttribute("class", "manageMemberAction");
                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;");
                buttonDiv.setAttribute("data-steamid", results[1]);
                buttonDiv.setAttribute("data-username", results[2]);
                buttonDiv.appendChild(document.createTextNode("⛔"));
                let insertedNode = kickbuttons[index].parentElement.insertBefore(buttonDiv, kickbuttons[index]);
                insertedNode.addEventListener("click", BanEventHandler);
            }
        }
    }
    let script = document.createElement("script");
    script.setAttribute("src","https://community.cloudflare.steamstatic.com/public/javascript/forums.js");
    document.head.appendChild(script);
    updateButtons(document.documentElement);

})();