ftv

try to take over the world!

Per 19-10-2017. Zie de nieuwste versie.

Voor het installeren van scripts heb je een extensie nodig, zoals Tampermonkey, Greasemonkey of Violentmonkey.

Voor het installeren van scripts heb je een extensie nodig, zoals {tampermonkey_link:Tampermonkey}.

Voor het installeren van scripts heb je een extensie nodig, zoals Tampermonkey of Violentmonkey.

Voor het installeren van scripts heb je een extensie nodig, zoals Tampermonkey of Userscripts.

Voor het installeren van scripts heb je een extensie nodig, zoals {tampermonkey_link:Tampermonkey}.

Voor het installeren van scripts heb je een gebruikersscriptbeheerder nodig.

(Ik heb al een user script manager, laat me het downloaden!)

Voor het installeren van gebruikersstijlen heb je een extensie nodig, zoals {stylus_link:Stylus}.

Voor het installeren van gebruikersstijlen heb je een extensie nodig, zoals {stylus_link:Stylus}.

Voor het installeren van gebruikersstijlen heb je een extensie nodig, zoals {stylus_link:Stylus}.

Voor het installeren van gebruikersstijlen heb je een gebruikersstijlbeheerder nodig.

Voor het installeren van gebruikersstijlen heb je een gebruikersstijlbeheerder nodig.

Voor het installeren van gebruikersstijlen heb je een gebruikersstijlbeheerder nodig.

(Ik heb al een beheerder - laat me doorgaan met de installatie!)

// ==UserScript==
// @name         ftv
// @version      5.0.4
// @namespace    http://tampermonkey.net/
// @description  try to take over the world!
// @author       You
// @match https://www.youtube.com/live_chat?continuation=0ofMyAMmGiBDZzhLRFFvTFdIaEtTMjVFVEZsYWVqUWdBUSUzRCUzRDABaAE%253D
// @require http://code.jquery.com/jquery-2.1.4.min.js
// @require https://code.jquery.com/ui/1.12.1/jquery-ui.js
// @grant        none
// ==/UserScript==
$(document).ready(function(){
    var my= $("yt-img-shadow#avatar").find("img").attr("src").substr(22,6);
    add();
    $("#title").append("<img id='listbtn' style='cursor:pointer;width:24px;height:24px;' src='https://gaming.youtube.com/s/gaming/emoji/72836fb0/emoji_u1f60e.svg' alt='過濾名單' >");
    $("body").append("<div id='list' style='border:1px #426487 solid;font-size:small;display:none;position:absolute;right:0px;z-index:999;background:#fff;'></div>");
    $("#listbtn").click(function(){$("#list").toggle(200);});
    $("#listbtn").mouseleave(function(){ $(this).attr("src","https://gaming.youtube.com/s/gaming/emoji/72836fb0/emoji_u1f60e.svg");});
    $("#listbtn").mouseover(function(){ $(this).attr("src","https://gaming.youtube.com/s/gaming/emoji/72836fb0/emoji_u1f633.svg");});
    $("div#items").on("DOMNodeInserted",function(e){
        if(e.target.tagName == "SPAN" ){
            var a = e.target.parentNode.parentNode.firstChild.childNodes[0].src.substr(22,6);
            $("yt-live-chat-text-message-renderer").last().hide();
            var m = $("yt-live-chat-text-message-renderer").last().find("img#img");
            setTimeout(function(){
if($("[id='"+a+"']").html() === undefined){$(this).remove();}
                m.attr("it",a).attr("new","o").attr("ix",m.parents("yt-live-chat-text-message-renderer").attr("id").substr(30,10)).css({"cursor":"pointer"});
                var mp = $('.mp').map(function() {
                    return this.id;
                }).get().join('');
                if(mp.match(m.attr("it")) != m.attr("it") || m.attr("it") == my){
                    $("div#items").css("transform","translatey(-2px)");
                    $("div#items").css("transform","translatey(-2px)");
                    $("[it='"+a+"']").parents("yt-live-chat-text-message-renderer").slideDown(200);
                }else{
                    $("[id='"+a+"']").animate({opacity:'0'}).animate({opacity:'1'});
                    console.log($("[id='"+a+"']").html()+":"+m.parents("yt-live-chat-text-message-renderer").find("span#message").text());
                }
                m.last().one("click",function(){
                    // $("#list").append(m.attr("it")+"【");
                    $("#list").append("<div style='background:#666666;color:#fff;margin:1px;padding:1px;cursor:pointer;' class='mp' id='"+m.attr("it")+"'>"+m.parents("yt-live-chat-text-message-renderer").find("#author-name").html().substr(0,10)+"</div>");
                    $("[it='"+m.attr("it")+"']").parents("yt-live-chat-text-message-renderer").hide();
                    $(".mp").click(function(){$(this).remove();});
                });
            },600);
        }
    });
    function add(){
        $("yt-live-chat-text-message-renderer").find("img#img").each(function(){
            if(!$(this).attr("new")){
                $(this).css("cursor","pointer").attr("new","o").attr("it",$(this).attr("src").substr(22,6));
                $(this).on("click",function(){
                    $("#list").append("<div style='background:#666666;color:#fff;margin:1px;padding:1px;cursor:pointer;' class='mp' id='"+$(this).attr("it")+"'>"+$(this).parents("yt-live-chat-text-message-renderer").find("#author-name").html().substr(0,10)+"</div>");
                    $("[it='"+$(this).attr("it")+"']").parents("yt-live-chat-text-message-renderer").hide();
                    $(".mp").click(function(){$(this).remove();});
});
            }
            if($("#list").text().match(String($(this).attr("it")))){
                $(this).parents("yt-live-chat-text-message-renderer").hide();
            }
        });
    }
});