twitchPlaysDarkFilterChat

A script to filter out the chat commands in Twitch Plays Dark Souls

Stan na 17-08-2015. Zobacz najnowsza wersja.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Greasemonkey lub Violentmonkey.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana będzie instalacja rozszerzenia Tampermonkey lub Userscripts.

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

Aby zainstalować ten skrypt, musisz zainstalować rozszerzenie menedżera skryptów użytkownika.

(Mam już menedżera skryptów użytkownika, pozwól mi to zainstalować!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Musisz zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

(Mam już menedżera stylów użytkownika, pozwól mi to zainstalować!)

// ==UserScript==
// @name       twitchPlaysDarkFilterChat
// @namespace   twitchPlaysDarkFilterChat
// @include     *.twitch.tv/twitchplaysdark
// @include     *.twitch.tv/twitchplaysdark/chat?popout=
// @version     0.9
// @description A script to filter out the chat commands in Twitch Plays Dark Souls
// ==/UserScript==
//
var filterActive = false;
var toBeFiltered= [
    "arl",
    "ar",
    "al",
    "d",
    "ard",
    "aru",
    "arr",
    "m",
    "f",
    "b",
    "l",
    "r",
    "e",
    "rf",
    "rb",
    "rl",
    "rr",
    "u",
    "g",
    "a",
    "du",
    "dd",
    "dl",
    "dr",
    "r1",
    "r2",
    "l1",
    "l2",
    "fl",
    "bs",
	"lr",
	"democracy",
	"anarchy",
	"autowalk",
	"babysteps",
	"nomenu",
	"menubutton",
	"banmenu",
	"banm",
	"chaos",
	"unbanm",
	"auto-walk",
	"auto"
];
var chatParent = document.getElementsByClassName("chat-lines")[0];
var interval;

function filterChat(event){
    if(event.target.children == undefined)
    {
        return;
    }
    var message = event.target.children[0].children[5].innerHTML;

    for(x=0;x<toBeFiltered.length;x++)
    {
        if(message.toUpperCase().replace(/\s+/g, '') === toBeFiltered[x].toUpperCase().replace(/\s+/g, '')){
            chatParent.removeChild(event.target);
            break;
        }
    }
}

function checkIfLoaded()
{	
	chatParent = document.getElementsByClassName("chat-lines")[0];
	try{chatParent.children}
	catch(err)
	{
	return;
	}
chatParent.addEventListener("DOMNodeInserted",filterChat);
window.clearInterval(interval);
}

interval = window.setInterval(checkIfLoaded,20);