twitchPlaysDarkFilterChat

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

اعتبارا من 21-08-2015. شاهد أحدث إصدار.

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

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

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

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

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

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

(I already have a user script manager, let me install it!)

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.

ستحتاج إلى تثبيت إضافة مثل Stylus لتثبيت هذا النمط.

ستحتاج إلى تثبيت إضافة لإدارة أنماط المستخدم لتتمكن من تثبيت هذا النمط.

ستحتاج إلى تثبيت إضافة لإدارة أنماط المستخدم لتثبيت هذا النمط.

ستحتاج إلى تثبيت إضافة لإدارة أنماط المستخدم لتثبيت هذا النمط.

(لدي بالفعل مثبت أنماط للمستخدم، دعني أقم بتثبيته!)

// ==UserScript==
// @name       twitchPlaysDarkFilterChat
// @namespace   twitchPlaysDarkFilterChat
// @include     *.twitch.tv/twitchplaysdark
// @include     *.twitch.tv/twitchplaysdark/chat?popout=
// @version     0.92
// @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",
    "demo",
    "anarchy",
    "autowalk",
    "baby",
    "babysteps",
    "nomenu",
    "menubutton",
    "banmenu",
    "unbanmenu", 
    "banm",
    "chaos",
    "unbanm",
    "auto-walk",
    "auto",
    "delaydn",
    "delayup"
];
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;
    message = message.toUpperCase().replace(/\s+/g, '');
    var compare;
    for(x=0;x<toBeFiltered.length;x++)
    {
        compare = toBeFiltered[x].toUpperCase().replace(/\s+/g, '').substr(0,message.length);
        
        if(message === compare){
            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);