ftv

try to take over the world!

Fra og med 10.10.2017. Se den nyeste version.

// ==UserScript==
// @name         ftv
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  try to take over the world!
// @author       You
// @match https://www.youtube.com/*
// @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(){
    add();
$("#primary-content").append("<button id='listbtn'>List</button>");
    $("body").append("<div id='list' style='border:1px #000 solid;font-size:small;display:block;position:absolute;right:0px;z-index:999;background:#fff;'></div>");
    $("#listbtn").click(function(){$("#list").toggle(500);});
    $("div#items").on("DOMNodeInserted",function(e){
        if(e.target.id == "message"){
            add();
        }
    });
    function add(){
        $("yt-live-chat-text-message-renderer").find("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($(this).attr("it")+"【");
                    $("#list").append($(this).parents("yt-live-chat-text-message-renderer").find("#author-name").html()+"】<br>");
                    $("[it='"+$(this).attr("it")+"']").parents("yt-live-chat-text-message-renderer").hide();
                });
            }
            if($("#list").text().match(String($(this).attr("it")))){
                $(this).parents("yt-live-chat-text-message-renderer").hide();
            }
        });
    }
});