/mute y /unmute

Agrega al chat de kongregate.com el comando /mute [-l] <nombres separados por espacio>.

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。

您需要先安装用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         /mute y /unmute
// @namespace    Klatu
// @version      3
// @description  Agrega al chat de kongregate.com el comando /mute [-l] <nombres separados por espacio>.
// @author       Klatu
// @match        http://www.kongregate.com/games/*/*
// @grant        none
// ==/UserScript==

document.observe('holodeck:ready', function() {
    holodeck.addChatCommand('mute', function(a, b){
        var listar=false;
        b=b.split(' ');
        b.shift();
        b.each(function(user){
            const regex=/^[0-9a-zA-Z][\w]{3,15}$/;
            if(user==='-l'||user==='--list') listar=true;
            else if(regex.exec(user)!==null){
                holodeck.addMuting(user);
                new Ajax.Request("/accounts/"+holodeck.username()+"/muted_users?username="+user+"&from_chat=true",{
                    asynchronous: !0,
                    evalScripts: !0,
                    method: "post"
                });
                holodeck._active_dialogue.kongBotMessage(user+' muteado.');
            }
        });
        if(listar){
            var msj='Muteaste a las siguientes cuentas: ';
            for(var user in holodeck._chat_window._mutings) if(holodeck._chat_window._mutings[user]) msj+=user+', ';
            msj=msj.substring(0, msj.length-2)+'.'; //elimina el último ', ' y agrega un '.'
            holodeck._active_dialogue.kongBotMessage(msj);
        }
        return!1;
    });
    holodeck.addChatCommand('unmute', function(a, b){
        var listar=false;
        b=b.split(' ');
        b.shift();
        b.each(function(user){
            const regex=/^[0-9a-zA-Z][\w]{3,15}$/;
            if(user==='-l'||user==='--list') listar=true;
            else if(regex.exec(user)!==null){
                holodeck.removeMuting(user);
                new Ajax.Request("/accounts/"+holodeck.username()+"/muted_users/"+user+".chat",{
                    asynchronous: !0,
                    evalScripts: !0,
                    method: "delete"
                });
                holodeck._active_dialogue.kongBotMessage(user+' desmuteado.');
            }
        });
        if(listar){
            var msj='Muteaste a las siguientes cuentas: ';
            for(var user in holodeck._chat_window._mutings) if(holodeck._chat_window._mutings[user]) msj+=user+', ';
            msj=msj.substring(0, msj.length-2)+'.'; //elimina el último ', ' y agrega un '.'
            holodeck._active_dialogue.kongBotMessage(msj);
        }
        return!1;
    });
});