Twitch Plays Pokemon Chat Filter

Chat commands from the Twitch Plays Pokemon stream are filtered.

当前为 2015-03-31 提交的版本,查看 最新版本

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name        Twitch Plays Pokemon Chat Filter
// @description Chat commands from the Twitch Plays Pokemon stream are filtered.
// @namespace   http://userscripts.org/users/magmarfire
// @include     *twitch.tv/twitchplayspokemon
// @version     1.7
// @grant       none
// ==/UserScript==

// Changelog:
// v1.7: TPP Arena shorthand move support added.
// v1.6: ZL/ZR buttons added for the Wii U.
// v1.5: TPP Arena move commands added.
// v1.4: 3DS Control Stick and D-pad added.
// v1.3: Betting commands now filtered.
// v1.2: Nintendo DS support added.
// v1.1: Added support for comma syntax (in Democracy mode).
// v1.0: Original script

$(document).ready(function() {
    var regex = /^((((c?d?(left|right|up|down)|start|select|wait|anarchy|democracy|a|b|l|r|x|y|z|\d|[ ])(\d|\+|,\s?)?)*)|(\!bet \d* (red|blue))|(!(move )?(a|b|c|d|-))|(!balance))$/i;

    $("head").append("<style type='text/css'>.chat-line { display: none; }</style>");

    var myUsername = $("#you .username").text().toLowerCase();

    setInterval(function() {
        var messages = $(".chat-line");
        messages.each(function() {
            var message = $(".message", this).text();
            var from = $(".from", this).text().toLowerCase();

            if (!regex.test(message.trim()) && (from !== "tppbankbot" || message.toLowerCase().indexOf(myUsername) > -1)) {
                $(this).show();
            }
        });
    }, 200);
});