twitchPlaysDarkFilterChat

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

Verze ze dne 17. 08. 2015. Zobrazit nejnovější verzi.

K instalaci tototo skriptu si budete muset nainstalovat rozšíření jako Tampermonkey, Greasemonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Userscripts.

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

K instalaci tohoto skriptu si budete muset nainstalovat manažer uživatelských skriptů.

(Už mám manažer uživatelských skriptů, nechte mě ho nainstalovat!)

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.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Už mám manažer uživatelských stylů, nechte mě ho nainstalovat!)

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