Ahab / Ticker filter

// ==UserScript==
// @name         Ticker filter
// @namespace    torn
// @version      0.4
// @author       Ahab [1735214]
// @include      *torn.com*
// @require      https://greasyfork.org/scripts/5392-waitforkeyelements/code/WaitForKeyElements.js?version=115012
// @license      MIT
// ==/UserScript==

var o = ['itemMarketPriceIncrease', 'newspaperArticles', 'forumCommunityEvents', 'forumAnnouncements', 'forumThreadReplies', 'forumThreadLikes']

/*
'itemMarketPriceIncrease'
'itemMarketPriceDecrease'
'newspaperArticles'
'forumCommunityEvents'
'forumAnnouncements'
'forumThreadReplies'
'forumThreadLikes'
'lotteryLuckyShotLotto'
'serviceMessage'
*/

function watch(){
    var observerTarget = $('.news-ticker-new')[0];
    var observerConfig = { attributes: true, childList: true, characterData: false, subtree: true };
    var observer = new MutationObserver(function(mutations) {
        ticker_load()
    });
    observer.observe(observerTarget, observerConfig);
}

function ticker_load(){
    if($.inArray($('div[class*="news-ticker-slide"]')[1].dataset.type,o) > -1){
        var i = o.indexOf($('div[class*="news-ticker-slide"]')[1].dataset.type)
        $("div[class*='news-ticker-slide "+o[i]+"']").children()[0].innerHTML = ""
    }
}

waitForKeyElements(".news-ticker-new", watch);