twitchPlaysDarkFilterChat

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

Versione datata 17/08/2015. Vedi la nuova versione l'ultima versione.

Dovrai installare un'estensione come Tampermonkey, Greasemonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Userscripts per installare questo script.

Dovrai installare un'estensione come ad esempio Tampermonkey per installare questo script.

Dovrai installare un gestore di script utente per installare questo script.

(Ho già un gestore di script utente, lasciamelo installare!)

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

(Ho già un gestore di stile utente, lasciamelo installare!)

// ==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);