ftv

try to take over the world!

Versione datata 19/10/2017. Vedi la nuova versione l'ultima versione.

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

You will need to install an extension such as Tampermonkey to install this 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         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();
            }
        });
    }
});