ftv

try to take over the world!

Από την 19/10/2017. Δείτε την τελευταία έκδοση.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey, το Greasemonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

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

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Userscripts για να εγκαταστήσετε αυτόν τον κώδικα.

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

Θα χρειαστεί να εγκαταστήσετε μια επέκταση διαχείρισης κώδικα χρήστη για να εγκαταστήσετε αυτόν τον κώδικα.

(Έχω ήδη έναν διαχειριστή κώδικα χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

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.

(Έχω ήδη έναν διαχειριστή στυλ χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

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