YouTube chat filter&report

abcdefg

当前为 2022-03-18 提交的版本,查看 最新版本

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         YouTube chat filter&report
// @namespace    null
// @version      1.0.4
// @description  abcdefg
// @author       null
// @match        *://*.youtube.com/*
// @grant        GM_registerMenuCommand
// @grant        GM_unregisterMenuCommand
// @grant        GM_addStyle
// ==/UserScript==
(function () {
    'use strict';
    let replay=window.location.pathname !== "/live_chat_replay"
    if (window.location.pathname !== "/live_chat"&&replay) return;
    if (window.location.pathname!=window.parent.location.pathname)window.parent.document.querySelector("YTD-LIVE-CHAT-FRAME#chat").style.minHeight= "850px";
    //////////Plugin required [ScTranslator] https://github.com/chunibyocola/sc-translator-crx/discussions/19 /////////////
    //////////////////////////////////要用翻译先安装sc翻译扩展////////////////////////////////////////////////////
    const TNT = GM_registerMenuCommand("Translate", () => {//Modify to your language st-result
        let sc=window.parent.document.getElementById("sc-translator-shadow")||document.getElementById("sc-translator-shadow")
        if (sc){
            let EliteMiko=sc.shadowRoot.childNodes[4].querySelector(".st-result")
            let scc = new MutationObserver((node) => {
                node.forEach((me)=>{
                    me.addedNodes.forEach((you)=>{
                        if (you?.children?.length==1&&you?.children[0].nodeName=="SPAN"){
                            let selection = window.getSelection ? window.getSelection() : window.document.getSelection();
                            let messs=selection.focusNode
                            if(messs.id=="message"||!messs.nextSibling){
                                const Translate= messs.cloneNode()
                                messs.style.display = "none"
                                Translate.id="Translate"
                                Translate.style.color="rgb(0, 200, 255)"
                                Translate.innerText = you.innerText
                                messs.after(Translate)
                            }
                        }
                    })
                })
            });
            scc.disconnect();
            scc.observe(EliteMiko,{
                childList: true
            });
        }else{
            alert("ScTranslate is not installed ")
        }
    });
    ///////////////////////////////////////////////////////////////////////////////////report interval////////////
    let S_Username = [],Keylist = [],Keylist_trun = [],Hoshimati = [],Anemati=[];/////////↓///////////
    let ONOff=true,nethe=0,tipoff=false,color,Time = localStorage.getItem("Time")||20000,time = 2200,wait = 10000,Achan=null,Ch_n=0 ,Ch_m = 0,spam=17,Bchan,Interval,ar=0,Yagoo,Itemslist,arof=1;
    let log_1=0,log_2=0,log_3=0,log_4=0,log_5=0,log1,log2,log3,log4,log5,color_ames,control=true,end,korone,TTK=false,ssr,outtime=1,error
    let ctm = 0, Key_l =localStorage.getItem("Key_l")||16 , BBQ =localStorage.getItem("BBQ")||3 ,auto_p = 0,auto_p_n,click = 0,img_pvp=[] ,imgg = [],textmes=[]
    let re = /<img.*src.*alt.*>|\[.{1,5}\]|[\[\]\-\_\,\!\|\.\~\`\(\)\#\$\%\^\&\*\+\-\{\}\:\;\"\<\>\@\?\\\/\s\=]|\’|\'/g
    GM_addStyle(".Report_Item{user-select:none;cursor:pointer;background-color:#0000;border-bottom:1px;border-style:solid;border-bottom-color:#22ff028c;overflow:auto;overflow-x:hidden;line-height :25px}")
    GM_addStyle(".P_key{user-select:none;cursor:pointer;text-indent:25px;width:100%;height:100%;display:inline-block}")
    GM_addStyle("#key_mes{user-select:none;height:100%;overflow :scroll;overflow-x:auto}")
    GM_addStyle(".Title_top{width:100%;height:100%;text-align:center;display:inline-block;cursor:pointer}")
    GM_addStyle("#keyword_frame{overflow-y:auto;width:100%;height:100%;max-height:350px;overflow-x:hidden}")
    GM_addStyle("#automes{display:inline-flex;height:175px;width: 100%;flex-direction:row}")
    GM_addStyle("#img_box{overflow-y:auto;width:40%;height:100%;flex-grow:0}")
    GM_addStyle("#mes_box{overflow-y:auto;width:40%;height:100%;flex-grow:1;display:inline-flex;flex-direction:column}")
    GM_addStyle(".gura{overflow:auto;overflow-x:hidden;max-height:149px;line-height :17px}")
    GM_addStyle("#new_div_chat{overflow-y:auto;height:175px;overflow:scroll}")
    GM_addStyle(".Calliope{line-height:35px;height:20%;width:100%;display:inline-block}")
    GM_addStyle(".log{line-height:20px;height:20px;width:100%}")
    GM_addStyle("#settingitem{user-select:none}")
    GM_addStyle("#ChatMes,#Log,#dad:hover{cursor:pointer}")
    function css_white(){
        color = "rgba(0, 0, 0, 0.23)"
        GM_addStyle(".set_list{width:25%;height:25px;display:inline-block;background-color:rgba(75, 75, 75, 0.2);text-align:center;user-select:none;line-height:25px;cursor:pointer}")
        GM_addStyle(".set_item_list{height :25px;background-color:rgba(0, 0, 0, 0.23);text-indent: 10px;font-size:16px;line-height:25px;cursor:pointer}")
        GM_addStyle(".MainWindow_css{height:250px;overflow:hidden;border-bottom:1px;border-style:solid;border-bottom-color:#0241ff;display:inline-flex;flex-direction:column;overflow:hidden}")
        GM_addStyle("textarea{resize: none;width:100%;height:169px;overflow-x:hidden;border-left:0px;border-top:0px;border-right:0px;border-bottom:0px;color:#000000;background-color:#f9f9f9}")//
        GM_addStyle(".auto_mes_p{min-height: 18px;padding: 2px 0;line-height: 18px;border-bottom:1px;border-style:solid;border-bottom-color:#00000075}")
        GM_addStyle("#other{overflow-y:auto;width:20%;height:100%;flex-grow:0;background-color:rgba(0, 0, 0, 0.23);text-align:center}")
    }
    function css_black(){
        color = "#4b4b4b"
        GM_addStyle(".set_list{width:25%;height:25px;display:inline-block;background-color:#363333;text-align:center;user-select:none;line-height:25px;cursor:pointer}")
        GM_addStyle(".set_item_list{height :25px;background-color:#4b4b4b;text-indent: 10px;font-size:16px;;line-height:25px;cursor:pointer}")
        GM_addStyle(".MainWindow_css{height:250px;overflow:hidden;border-bottom:1px;border-style:solid;border-bottom-color:#ff00006e;display:inline-flex;flex-direction:column;overflow:hidden}")
        GM_addStyle("textarea{resize: none;width:100%;height:169px;overflow-x:hidden;border-left:0px;border-top:0px;border-right:0px;border-bottom:0px;color:#FFFFFF;background-color:#181818}")//
        GM_addStyle(".auto_mes_p{min-height: 18px;padding: 2px 0;line-height: 18px;border-bottom:1px;border-style:solid;border-bottom-color:#cec0ff78}")
        GM_addStyle("#other{overflow-y:auto;width:20%;height:100%;flex-grow:0;background-color:#4b4b4b;text-align:center}")
    }
    launch()
    function launch() {
        const New_Chat_Frame = document.querySelector("#contents.yt-live-chat-renderer");
        if (New_Chat_Frame){
            switch (window.getComputedStyle(New_Chat_Frame, null)?.getPropertyValue('border-color'))
            {
                case "rgb(255, 255, 255)":
                    css_black()
                    color_ames="#ffffff"
                    break;
                case "rgb(3, 3, 3)":
                    css_white()
                    color_ames="#000000"
                    break;
            }
        }
        Itemslist = document.querySelector("#items.yt-live-chat-item-list-renderer");
        if (!Itemslist) return;
        const DMM=localStorage.getItem("IMGitem");
        const Important_Frame = document.createElement("div");
        Important_Frame.id = "MainWindow";
        Important_Frame.setAttribute("class","MainWindow_css");
        const shion = document.createElement("div");
        const Setting = document.createElement("div");
        const Settinglist = document.createElement("div");
        const SettingItem = document.createElement("div")
        const O_Item = document.createElement("div");
        const shion_p = document.createElement("span");
        O_Item.style.flexGrow="1";
        O_Item.style.height = "175px";
        Setting.id = "setting";
        shion.id="state"
        shion.setAttribute("class","set_item_list")
        shion_p.id="tex"
        Settinglist.id = "settinglist";
        SettingItem.id = "settingitem";
        for (let i=0;i<4;i++){
            const set_List = document.createElement("div");
            const set_Item_List = document.createElement("div");
            const Title = document.createElement("span");
            Title.setAttribute("class","Title_top");
            set_List.setAttribute("class","set_list");
            set_Item_List.setAttribute("class","set_item_list");
            set_Item_List.style.display = "none";
            switch (i)
            {
                case 0:
                    set_List.id = "Input_Key_List";
                    set_Item_List.id = "Input_Key_Item";
                    set_Item_List.style.display = "";
                    Title.innerHTML = "Keys";//Modify to your language
                    //Title.innerHTML = "关键词";//Modify to your language
                    Title.id = "T1";
                    break;
                case 1:
                    set_List.id = "gauging";
                    set_Item_List.id = "gauging_Item";
                    Title.innerHTML = "Messages";//Modify to your language
                    //Title.innerHTML = "长留言";//Modify to your language
                    Title.id = "T2";
                    break;
                case 2:
                    set_List.id = "report_T";
                    set_Item_List.id = "report_Item";
                    Title.innerHTML = "Report";//Modify to your language
                    //Title.innerHTML = "举报";//Modify to your language
                    Title.id = "T3";
                    break;
                case 3:
                    set_List.id= "Speech";
                    set_Item_List.id = "speech_Item";
                    Title.innerHTML = "Speech";//Modify to your language
                    //  Title.innerHTML = "报告";//Modify to your language
                    Title.id = "T4";
                    break;
            }
            Settinglist.appendChild(set_List);
            set_List.appendChild(Title);
            SettingItem.appendChild(set_Item_List);
        }
        shion_p.innerText = "Save keywords to local text for next use "//Modify to your language
        //shion_p.innerText = "手动保存关键词到本地文本文档以备下次使用 "//Modify to your language
        shion.appendChild(shion_p);
        Setting.appendChild(Settinglist);
        Setting.appendChild(SettingItem);
        Important_Frame.appendChild(Setting);
        Important_Frame.appendChild(shion);
        New_Chat_Frame.before(Important_Frame);
        const MainWindow = document.getElementById("MainWindow");
        const self= document.querySelector("div#top")?.querySelector("yt-live-chat-author-chip")
        let myname =self?.querySelector("#author-name")?.innerText
        const Inputs = document.getElementById("Input_Key_Item");
        const Report_Frame= document.getElementById("report_Item");
        const gauging_Item = document.getElementById("gauging_Item");
        const speech_Item= document.getElementById("speech_Item");
        const speech_Item_0 = document.createElement("div");
        const speech_Item_p1= document.createElement("span");
        const speech_Item_p2= document.createElement("span");
        const speech_Item_p3= document.createElement("span");
        Inputs.style.display="none"
        gauging_Item.style.display=""
        speech_Item_0.id="Time_Set"
        speech_Item_0.appendChild(speech_Item_p1)
        speech_Item_0.appendChild(speech_Item_p2)
        speech_Item_0.appendChild(speech_Item_p3)
        speech_Item_p1.innerText= "Interval:("//Modify to your language
        // speech_Item_p1.innerText= "发言间隔:("//Modify to your language
        speech_Item_p2.id = "Ti"
        speech_Item_p2.setAttribute('contenteditable', 'true')
        speech_Item_p2.innerText= Time/1000
        speech_Item_p3.innerText= ")Sec"//Modify to your language
        //speech_Item_p3.innerText= ")秒"//Modify to your language
        speech_Item.appendChild(speech_Item_0);
        speech_Item_p2.addEventListener('keydown', function (e) {if(e.keyCode == 13)speech_Item_p2.blur()})
        const TItle_1= document.getElementById("Input_Key_List");
        const TItle_2= document.getElementById("gauging");
        const TItle_3= document.getElementById("report_T");
        const TItle_4= document.getElementById("Speech");
        const Report_SET = document.createElement("div");
        const Report_key_mes = document.createElement("div");
        const gauging_0 = document.createElement("div");
        const gauging_1 = document.createElement("div");
        const gauging_00 = document.createElement("span");
        const gauging_01 = document.createElement("span");
        const gauging_02 = document.createElement("span");
        const gauging_10 = document.createElement("span");
        const gauging_11 = document.createElement("span");
        const gauging_12 = document.createElement("span");
        gauging_0 .style.display = "inline-block";
        gauging_0.id = "Key_l"
        gauging_00.innerText = "Filter messages greater than:";//Modify to your language
        //gauging_00.innerText = "过滤出大于这个数字的发言:";//Modify to your language
        gauging_01.innerText = Key_l
        gauging_01.setAttribute('contenteditable', 'true')
        // gauging_02.innerText = ""//Modify to your language
        gauging_01.addEventListener('keydown', function (e) {if(e.keyCode == 13)gauging_01.blur()})
        gauging_0 .style.textIndent="0px";
        gauging_1.style.display = "inline-block";
        gauging_1.id = "BBQ"
        gauging_10.innerText = "Standard:";//Modify to your language
        //gauging_10.innerText = "量衡标准:";//Modify to your language
        gauging_11.innerText = BBQ
        gauging_11.setAttribute('contenteditable', 'true')
        gauging_12.innerText = ""
        gauging_11.addEventListener('keydown', function (e) {if(e.keyCode == 13)gauging_11.blur()})
        gauging_0.appendChild(gauging_00);
        gauging_0.appendChild(gauging_01);
        gauging_0.appendChild(gauging_02);
        gauging_1.appendChild(gauging_10);
        gauging_1.appendChild(gauging_11);
        gauging_1.appendChild(gauging_12);
        gauging_Item.appendChild(gauging_0);
        gauging_Item.appendChild(gauging_1);
        Report_SET.id = "report_";
        Report_SET.style.display="inline-flex";
        Report_SET.style.textIndent= "0px";
        const Report_SET_0 = document.createElement("span");
        const Report_SET_1 = document.createElement("span");
        const Report_SET_2 = document.createElement("div");
        const Report_SET_2_p = document.createElement("span");
        const Report_SET_0_Input = document.createElement("input");
        Report_SET_0_Input.type="checkbox";
        Report_SET_0_Input.id = "Auto_Report";
        Report_SET_0.innerHTML="Quickly Report";//Modify to your language
        //Report_SET_0.innerHTML="快速举报";//Modify to your language
        Report_SET_0.appendChild(Report_SET_0_Input);
        Report_SET_1.innerHTML="👈Open";//Modify to your language
        //Report_SET_1.innerHTML="👈开启";//Modify to your language
        Report_SET_1.id = "ReportSET"
        Report_SET_2_p.innerHTML="👉Automatic report👈";//Modify to your language
        //Report_SET_2_p.innerHTML="👉自动举报👈";//Modify to your language
        Report_SET_2_p.id = "dad"
        Report_SET_2.style.textAlign="center";
        Report_SET_2.style.display="none"
        Report_SET_2.id = "A_Report"
        Report_key_mes.id = "key_mes";
        Report_key_mes.style.display = "none";
        Report_SET_2.appendChild(Report_SET_2_p);
        Report_SET.appendChild(Report_SET_0);
        Report_SET.appendChild(Report_SET_1);
        Report_Frame.appendChild(Report_SET);
        Report_SET.appendChild(Report_SET_2);
        MainWindow.appendChild(O_Item);
        const New_Chat = document.createElement("div");
        const Keyword_Frame = document.createElement("div");
        const Auto_mes = document.createElement("div");
        const Keyword_Frame_Textarea = document.createElement("textarea");
        Keyword_Frame_Textarea.id = "keys"
        const Auto_mes_L = document.createElement("div");
        Auto_mes_L.id = "img_box";
        const Auto_mes_O = document.createElement("div");
        const Auto_mes_O_P = document.createElement("span");
        const Auto_mes_R= document.createElement("div");
        const Auto_mes_log= document.createElement("div");
        const Auto_mes_log_x= document.createElement("div");
        Auto_mes_log.style.display="none"
        Auto_mes_log.style.width="40%"
        Auto_mes_O.id = "other";
        Auto_mes_O_P.innerHTML = "Ready";//Modify to your language
        ///Auto_mes_O_P.innerHTML = "就绪";//Modify to your language
        Auto_mes_O_P.id= "TTi"
        Auto_mes_O_P.style.textIndent="25px"
        Auto_mes_O_P.style.cursor="pointer"
        Auto_mes_log.appendChild(Auto_mes_log_x);
        self&&self.appendChild(Auto_mes_O_P);
        Auto_mes_R.id = "mes_box";
        Auto_mes.id = "automes";
        Auto_mes.appendChild(Auto_mes_L);
        Auto_mes.appendChild(Auto_mes_O);
        Auto_mes.appendChild(Auto_mes_R);
        Auto_mes.appendChild(Auto_mes_log);
        Auto_mes.style.display = "none";
        New_Chat.id = "new_div_chat";
        Keyword_Frame.style.display = "none";
        Keyword_Frame.id = "keyword_frame";
        Keyword_Frame_Textarea.placeholder = "Paste keywords here and click Add";//Modify to your language
        //Keyword_Frame_Textarea.placeholder = "复制关键词到这后点添加";//Modify to your language
        Keyword_Frame.appendChild(Keyword_Frame_Textarea);
        O_Item.appendChild(Keyword_Frame);
        O_Item.appendChild(New_Chat);
        O_Item.appendChild(Report_key_mes);
        O_Item.appendChild(Auto_mes);
        let Chat=document.getElementById("new_div_chat")
        for (let i=0;i<5;i++){
            const Mori = document.createElement("div");
            const Mori_p = document.createElement("span");
            Mori_p.setAttribute('class', 'Calliope')
            switch (i)
            {
                case 0:
                    Mori_p.id = "ChatMes"
                    Mori_p.innerText="Call"//Modify to your language
                    break;
                case 1:
                    Mori_p.id = "Log"
                    Mori_p.innerText="data"//Modify to your language
                    //Mori_p.innerText="数据"//Modify to your language
                    break;
            }
            Mori.appendChild(Mori_p);
            Auto_mes_O.appendChild(Mori);
        }
        for (let i=0;i<5;i++){
            const Log_p = document.createElement("span");
            const Log_p_0 = document.createElement("span");
            const Log_div = document.createElement("div")
            Log_p.setAttribute('class', 'log')
            Log_p_0.id = "Log_"+(i+1)
            switch (i)
            {
                case 0:
                    Log_p.innerText="Spam:"//Modify to your language
                    Log_p_0.innerText = 0
                    break;
                case 1:
                    Log_p.innerText="Account:"//Modify to your language
                    Log_p_0.innerText = ""
                    break;
            }

            Log_div.appendChild(Log_p);
            Log_div.appendChild(Log_p_0)
            Auto_mes_log_x.appendChild(Log_div);
        }
        log1 = document.getElementById("Log_1")
        log2 = document.getElementById("Log_2")
        log2.style.overflowY="scroll"
        log2.style.height="135px";
        log3 = document.getElementById("Log_3")
        log4 = document.getElementById("Log_4")
        log5 = document.getElementById("Log_5")
        if (DMM){img_pvp=DMM.split("|")
                 for (let item of img_pvp){
                     imgg=item.split(",")
                     imgset(imgg)
                     auto_p += 1
                 }
                }
        const Key_Frame = document.getElementById("keyword_frame")
        const Add_Input_Key = document.createElement("input")
        Add_Input_Key.id = "add_i_key";
        Add_Input_Key.type = "text";
        Add_Input_Key.placeholder = "Enter keyword"//Modify to your language
        //Add_Input_Key.placeholder = "输入单条关键词"//Modify to your language
        Add_Input_Key.maxlength = "500"
        Inputs.appendChild(Add_Input_Key)
        const Get_Key = document.getElementsByClassName("add_key")
        const Add_Button = document.createElement("input")
        Add_Button.type = "button"
        Add_Button.value = "Add"//Modify to your language
        Add_Button.id = "add_b_key"
        Inputs.appendChild(Add_Button)
        const Del_Button = document.createElement("input")
        Del_Button.type = "button"
        Del_Button.value = "Delete:"+Keylist_trun.length//Modify to your language
        Del_Button.id = "delete_key"
        Inputs.appendChild(Del_Button)
        const Addrun = document.getElementById("overflow")
        const Re = document.createElement("input")
        Re.type = "button"
        Re.id = "on_off"
        Re.value = "Hide"//Modify to your language
        Addrun.before(Re)
        const counter = document.createElement("span")
        counter.id = "miko"
        counter.innerHTML = New_Chat.querySelectorAll("yt-live-chat-text-message-renderer").length
        const Report_l = document.createElement("span")
        Report_l.id = "nrn"
        Report_l.innerHTML = log_2
        Report_l.style.display="none"
        Re.before(counter)
        Re.before(Report_l)
        function imgset(item){
            let Auto_mes_R = document.querySelector("#mes_box")
            const Auto_mes_P = document.createElement("span")
            Auto_mes_R.appendChild(Auto_mes_P)
            auto_p_n= "auto_p"+auto_p
            Auto_mes_P.id = "auto_p"+auto_p
            Auto_mes_P.setAttribute('contenteditable', 'true')
            Auto_mes_P.setAttribute('class', 'auto_mes_p')
            Auto_mes_P.onblur = function (){if (Auto_mes_P.innerHTML=="") Auto_mes_P.remove()}
            for(let img of item ){
                Auto_mes_P.innerHTML=img
            }
        }
        function Report(mes,key,key_i){
            let T_1 = document.createElement("div")
            let T_2 = document.createElement("div")
            let p_1 = document.createElement("span")
            let ID_key= "key_uid"+key_i
            let Mes_key= "mes_uid"+key_i
            T_1.id =ID_key
            T_2.id = Mes_key
            T_2.setAttribute('class', 'gura')
            T_2.style.display = "none"
            T_1.setAttribute("class","Report_Item")
            p_1.innerText=key.replace(/(\.\*)/g, "")
            p_1.id = "key_mes_p"
            p_1.setAttribute("class","P_key")
            T_1.appendChild(p_1)
            mes.querySelector("#message").style.color="#ffffff"
            Report_l.innerHTML=Report_key_mes.querySelectorAll("yt-live-chat-text-message-renderer").length
            let Mes_list = document.getElementById(Mes_key);
            setTimeout(()=>{
                mes.querySelector("#message").style.display = "";
                mes.querySelector("#ZOO").style.display="none"
                if(Mes_list){
                    Mes_list.appendChild(mes)
                }else {
                    T_2.appendChild(mes)
                    T_1.appendChild(T_2)
                    Report_key_mes.appendChild(T_1)
                }
            },6000)
        }
        function pekoname(name,mes_){//////////////////////////////////////
            let NCL = New_Chat.querySelectorAll("yt-live-chat-text-message-renderer")
            for (let i=0,l=NCL.length;i<l;i++){
                if (NCL[i].querySelector("#author-name").innerText!==name) continue
                let Cdk=NCL[i].querySelector("#message").innerHTML.replace(re, "")
                let cdk=GetKey(Cdk)
                Cdk!=mes_&&AddKey_List(cdk,Cdk)
                Report(NCL[i],cdk,key_i(cdk))
            }
        }
        function AutoReport(time){
            let OpenList=Report_key_mes.querySelectorAll(".gura")
            for (let item of OpenList ){
                if(item.style.display == "")item.style.display = "none"
            }
            Report_SET_2_p.innerText="Reporting:"+log_2//Modify to your language
            //Report_SET_2_p.innerText="举报中:"+log_2//Modify to your language
            korone=setInterval(() => {
                let Report_L=Report_key_mes.querySelector("yt-live-chat-text-message-renderer")
                if(Report_L){
                    if(error==Report_L?.id){
                        if(confirm("Skip this ?")){
                            Report_key_mes.querySelector("yt-live-chat-text-message-renderer").remove()
                        }
                        window.clearInterval(korone)
                        korone=null
                        error=null
                        Report_SET_2_p.innerText="|Completed("+log_2+")Again "//Modify to your language
                        return
                    }else{
                        error=Report_L.id
                        if(tipoff){
                            log_2 +=1
                            Report_SET_2_p.innerText="Reporting:"+log_2//Modify to your language
                            //Report_SET_2_p.innerText="举报中:"+log_2//Modify to your language
                            Achan=Report_L
                            Report_L.querySelector("#button.yt-icon-button").click()
                            Report_L.parentNode.style.background="#63aaf7"
                            Report_key_mes.scrollTop=Report_L.parentNode.parentNode.offsetTop-175
                            Report_L.parentNode.style.display = ""
                        }
                    }
                }else {
                    window.clearInterval(korone)
                    korone=null
                    error=null
                    Report_SET_2_p.innerText="|Completed("+log_2+")Again "//Modify to your language
                }
            }, time);
        }
        function AddItems(mes,uername,key,Ch_m,get_time) {
            let gdp = document.createElement("div")
            let key_list = document.createElement("div")
            let gdp_in_1 = document.createElement("div")
            gdp_in_1.id = "TOP"
            let gdp_in_2 = document.createElement("div")
            gdp_in_2.id = "Fold"
            gdp_in_2.style.display = "none"
            let gdp_in_3 = document.createElement("div")
            gdp_in_3.id = "L"
            gdp_in_3.style.display = "inline-block"
            gdp_in_3.style.width = "4%"
            let gdp_in_4 = document.createElement("div")
            gdp_in_4.id = "O"
            gdp_in_4.style.display = "inline-block"
            gdp_in_4.style.width = "96%"
            let C_Name=Chat.querySelectorAll(".Mio")
            key_list.id = get_time+"&"+Ch_m
            gdp.id = uername
            gdp.setAttribute("class","Mio")
            key_list.setAttribute("class","Tako")
            setTimeout(()=>{
                let m=New_Chat.firstElementChild?.id||"0&0"
                let tako = m.split("&")
                let Kronii_new=Number(get_time)
                let Kronii_Old=Number(tako[0])
                if(Kronii_new-Kronii_Old<0)Kronii_new+=60
                let T=Kronii_new-Kronii_Old
                if (Number(Ch_m)<BBQ&&Math.abs(T)<=BBQ&&Number(tako[1])<=BBQ){
                    let ol=New_Chat?.firstElementChild?.querySelector("#message")
                    if(ol)ol.style.color = "red"
                    mes.querySelector("#message").style.color = "red"
                }
                mes.querySelector("#message").style.display = "";
                mes.querySelector("#ZOO").style.display="none"
                gdp_in_1.appendChild(mes)
                gdp.appendChild(gdp_in_1)
                key_list.appendChild(gdp)
                New_Chat.prepend(key_list)
                counter.innerHTML = Number(counter.innerHTML)+1
                if (C_Name.length){
                    for (let i=0,l=C_Name.length;i<l;i++){
                        if(C_Name[i].id===uername){
                            let fold= C_Name[i].querySelectorAll("yt-live-chat-text-message-renderer")
                            for(let q = 0,k=fold.length;q<k;q++){
                                gdp_in_2.appendChild(gdp_in_3)
                                gdp_in_2.appendChild(gdp_in_4)
                                gdp_in_4.appendChild(fold[q])
                                gdp.appendChild(gdp_in_2)
                                fold[q].querySelector("#message").style.color = "#f700ff"
                                mes.querySelector("#message").style.color = "#f700ff"
                            }
                            counter.innerHTML = Number(counter.innerHTML)-1
                            C_Name[i].parentNode.remove()
                        }
                    }
                }
            },6000)
        }
        //===================================================onev===============================================================================
        New_Chat.onmouseover = function (e) {
            let E=e.target
            if (E.id == "message"||E.id=="Translate"){
                if(tipoff){
                    E.style.cursor="pointer"
                    E.style.userSelect="none"
                }else{
                    E.id=="message"?E.style.cursor="help":E.style.cursor="default"
                    E.style.userSelect="text";
                }
            }
        }
        New_Chat.onclick = function (e){
            if (tipoff&&(e.target.id == "message"||e.target.id=="Translate")){
                let Cdk
                Achan=null
                let mes=e.target.parentNode.parentNode
                Achan=mes.parentNode.parentNode.parentNode
                if(error==mes.id){
                    error=confirm("Skip this ?")?null:mes.id
                }else{
                    error=mes.id
                }
                e.target.id=="Translate"?Cdk = e.target.previousSibling.innerText: Cdk=e.target.innerText
                let cdk= GetKey(Cdk);
                Keylist.push(Cdk);
                Keylist_trun.push(cdk);
                Keylist=Array.from(new Set(Keylist));
                Keylist_trun=Array.from(new Set(Keylist_trun));
                if(mes.parentNode.parentNode.id=="Fold")Achan=mes.parentNode.parentNode
                if (error==null){
                    Achan.remove()
                    Achan=null
                }else{
                    mes.querySelector("#button.yt-icon-button").click();
                }
                error=mes.id
            }else if(!tipoff&&(e.target.id == "message"||e.target.id=="Translate")){
                if(e.target.id=="Translate"){
                    let Tran=e.target.previousSibling
                    Tran.style.display = ""
                    e.target.style.display = "none"
                }else if(e.target.id =="message"){
                    let Tran =e.target.nextSibling
                    if (Tran.id=="Translate"){
                        Tran.style.display = ""
                        e.target.style.display = "none"
                    }
                }
                let selection = window.getSelection();
                selection.removeAllRanges();
                let range = new Range();
                range.selectNodeContents(e.target);
                selection.addRange(range);
                if (window.getComputedStyle(e.target, null).getPropertyValue('color')=="rgb(247, 0, 255)"){
                    let b=e.target.parentNode.parentNode.parentNode.nextSibling
                    if(b){b.style.display == "none"?b.style.display = "":b.style.display = "none"}
                }}
        }
        Auto_mes_O_P.onclick=()=>{
            autocall(0,Time,true)
        }
        Auto_mes_L.onclick = function(e){
            if (e.target.nodeName=="IMG"){
                let img=document.createElement("img")
                img.src = e.target.src
                img.setAttribute('class', 'emoji yt-formatted-string style-scope yt-live-chat-text-input-field-renderer')
                img.style.cssText+="margin:-5px 2px;width:20px;height: 20px"
                img.alt= e.target.alt
                if (!auto_p_n){
                    const Auto_mes_P = document.createElement("span")
                    Auto_mes_R.appendChild(Auto_mes_P)
                    Auto_mes_P.id = "auto_p"+auto_p
                    Auto_mes_P.setAttribute('contenteditable', 'true')
                    Auto_mes_P.setAttribute('class', 'auto_mes_p')
                    Auto_mes_P.appendChild(img)
                    Auto_mes_P.onblur = function (y){if (Auto_mes_P.innerHTML=="") Auto_mes_P.remove()}
                    auto_p_n= "auto_p"+auto_p
                    auto_p += 1
                }else{
                    document.getElementById(auto_p_n)?.focus()
                    document.activeElement.appendChild(img)
                }
            }
        }
        Auto_mes_L.onmouseover = function(e){
            shion_p.innerText= "Click the emoji to add to content."//Modify to your language
            // shion_p.innerText= "点击表情加入发言内容"//Modify to your language
        }
        Auto_mes.onmouseleave = function(){
            let p =document.getElementById(auto_p_n)
            if (p){
                p.blur()
                auto_p_n=null
                localItem()
            }
            p=null
        }
        Auto_mes_O.onmouseover = function (e) {
            localItem()
            switch (e.target.id)
            {
                case "ChatMes":
                    shion_p.innerText= "on/off confrontation mode"//Modify to your language
                    //shion_p.innerText= "开/关 对喷模式"//Modify to your language
                    break;
                case "Log":
                    shion_p.innerText= "無意味なデータ"
                    break;
            }
        }
        Auto_mes_O.onclick = function (e) {
            switch (e.target.id)
            {
                case "ChatMes":
                    TTK?TTK=false:TTK=true
                    TTK?e.target.innerText="Confrontation":e.target.innerText="Call"
                    break;
                case "Log":
                    Auto_mes_R.style.display == "none"?Auto_mes_R.style.display = "":Auto_mes_R.style.display = "none"
                    Auto_mes_log.style.display == ""?Auto_mes_log.style.display = "none":Auto_mes_log.style.display = ""
                    break;
            }
        }
        Auto_mes_R.onclick =function(e){
            if (e.target.nodeName=="SPAN"){
                auto_p_n=e.target.id
            }else {
                auto_p_n=null
                localItem()
            }
        }
        Add_Button.onclick = function addkey() {
            if (Add_Input_Key.value != ""){
                Keylist.push(Add_Input_Key.value)
                Keylist_trun.push(GetKey(Add_Input_Key.value))
                Add_Input_Key.value = ""
                Del_Button.value = "Delete:"+Keylist_trun.length//Modify to your language
                Keyword_Frame_Textarea.value = Keylist.join("\n")
                return;
            }
            if (Keyword_Frame_Textarea.value!=""){
                let newn = []
                Keylist_trun=[]
                Keylist=Keyword_Frame_Textarea.value.split('\n')
                DellArray("",Keylist)
                Keylist=Array.from(new Set(Keylist));
                for (let i=0,l=Keylist.length;i<l;i++){
                    let item=Keylist[i].replace(re, "")
                    newn.push(item)
                    Keylist_trun.push(GetKey(item))
                }
                Keylist=newn
                DellArray("",Keylist_trun)
                Keylist_trun=Array.from(new Set(Keylist_trun));
                let key__=Keylist.join("\n")
                navigator.clipboard.writeText(key__).then(() => {})
                newn=null
                Del_Button.value = "Delete:"+Keylist_trun.length//Modify to your language
                Keyword_Frame_Textarea.value = Keylist.join("\n")
            }
        }
        Add_Input_Key.onfocus = function () {
            Key_Frame.style.display = ""
            Keyword_Frame_Textarea.value = Keylist.join("\n")
        }
        Del_Button.onclick = function () {
            Keylist_trun = []
            Keylist = []
            Del_Button.value = "Delete:"+Keylist_trun.length//Modify to your language
            Keyword_Frame_Textarea.value = ""
        }
        Keyword_Frame_Textarea.onclick = function (e) {
        }
        Report_key_mes.onclick = function (e) {
            if (click==0)setTimeout(()=>{click=0},400)
            click +=1
            if (click==1&&e.target.className == "P_key"){
                let x = e.target.parentNode.querySelector(".gura")
                x.style.display!="none" ? x.style.display = "none":x.style.display=""
            }else if (e.target.className == "P_key"&&click>1){
                let x = e.target.parentNode.querySelector(".gura")
                x.style.display = "none"
                let key_del= e.target.innerText
                let key_i
                if (confirm("Not spam, click OK to exclude ")){//Modify to your language
                    for (let i=0,l=Keylist_trun.length;i<l;i++){
                        let reg_kkey = new RegExp(Keylist_trun[i]);
                        if (reg_kkey.test(key_del)) {
                            key_i=i
                            break;
                        }
                    }
                    Keylist.splice(key_i,1)
                    Keylist_trun.splice(key_i,1)
                    e.target.parentNode.remove()
                    return
                }
            }
        }
        Report_SET_0_Input.onclick = function(){
            tipoff = Report_SET_0_Input.checked
            let of=arof?"report":"cancel";//Modify to your language
            //let of=arof?"举报":"取消";//Modify to your language
            tipoff?Report_SET_1.innerText="Mode:("+of+")":Report_SET_1.innerText="Closed";//Modify to your language
            window.clearInterval(Interval);
            Interval=null
            error=null
            tipoff?Report_SET_2.style.display="":Report_SET_2.style.display="none"
        }
        Re.onclick = function () {
            switch (Re.value)
            {
                case "Hide"://Modify to your language
                    MainWindow.style.display = "none"
                    Re.value = "View"//Modify to your language
                    break;
                case "View"://Modify to your language
                    MainWindow.style.display = ""
                    Re.value = "Hide"//Modify to your language
                    break;
            }
        }
        Settinglist.onclick = function (e){
            switch (e.target.id)
            {
                case "T1":
                    if(Inputs.style.display="none" )Inputs.style.display="";
                    if (Inputs.style.display==""){
                        TItle_1.style.backgroundColor=color
                        TItle_2.removeAttribute("style")
                        TItle_3.removeAttribute("style")
                        TItle_4.removeAttribute("style")
                        Report_Frame.style.display="none"
                        gauging_Item.style.display = "none"
                        speech_Item.style.display = "none"
                        New_Chat.style.display = "none"
                        Report_key_mes.style.display = "none"
                        Auto_mes.style.display = "none"
                        Keyword_Frame.style.display = ""
                        Keyword_Frame_Textarea.value = Keylist.join("\n")
                        Del_Button.value = "Delete:"+Keylist_trun.length//Modify to your language
                        shion_p.innerText= "Add single↑ or multiple↓ keywords. "//Modify to your language
                        //shion_p.innerText= "添加单条↑ 添加多条↓ 关键词. "//Modify to your language
                    }
                    break;
                case "T2":
                    if(gauging_Item.style.display="none")gauging_Item.style.display="";
                    if (gauging_Item.style.display==""){
                        TItle_1.removeAttribute("style")
                        TItle_2.style.backgroundColor=color
                        TItle_3.removeAttribute("style")
                        TItle_4.removeAttribute("style")
                        Report_Frame.style.display="none"
                        Inputs.style.display = "none"
                        speech_Item.style.display = "none"
                        New_Chat.style.display = ""
                        Report_key_mes.style.display = "none"
                        Auto_mes.style.display = "none"
                        Keyword_Frame.style.display = "none"
                        shion_p.innerText= "Open Quick Report,Click to speak to report "//Modify to your language
                        //shion_p.innerText= "开启快速举报后点击发言内容即可举报 "//Modify to your language
                        counter.innerHTML=New_Chat.querySelectorAll("yt-live-chat-text-message-renderer").length
                        counter.style.display = ""
                        Report_l.style.display = "none"
                    }
                    break;
                case "T3":
                    if (Report_Frame.style.display="none")Report_Frame.style.display="";
                    if (Report_Frame.style.display==""){
                        TItle_1.removeAttribute("style")
                        TItle_2.removeAttribute("style")
                        TItle_3.style.backgroundColor=color
                        TItle_4.removeAttribute("style")
                        Inputs.style.display="none"
                        gauging_Item.style.display = "none"
                        speech_Item.style.display = "none"
                        New_Chat.style.display = "none"
                        Report_key_mes.style.display = ""
                        Auto_mes.style.display = "none"
                        Keyword_Frame.style.display = "none"
                        shion_p.innerText= "↓Click to expand | Double click to delete ↓"//Modify to your language
                        // shion_p.innerText= "↓单击展开 | 双击删除 ↓"//Modify to your language
                        Report_l.innerHTML=Report_key_mes.querySelectorAll("yt-live-chat-text-message-renderer").length
                        Report_l.style.display = ""
                        counter.style.display = "none"
                    }
                    break;
                case "T4":
                    if (speech_Item.style.display="none")speech_Item.style.display="";
                    if (speech_Item.style.display==""){
                        TItle_1.removeAttribute("style")
                        TItle_2.removeAttribute("style")
                        TItle_3.removeAttribute("style")
                        TItle_4.style.backgroundColor=color
                        Report_Frame.style.display="none"
                        gauging_Item.style.display = "none"
                        Inputs.style.display = "none"
                        New_Chat.style.display = "none"
                        Report_key_mes.style.display = "none"
                        Auto_mes.style.display = ""
                        Keyword_Frame.style.display = "none"
                        shion_p.innerText= "Set interval and content. "//Modify to your language
                        //shion_p.innerText= "设置发言间隔 "//Modify to your language
                        iron_load()
                    }
                    break;
            }
        }
        SettingItem.onclick =function(e){
            if(e.target.nodeName=="SPAN"){
                let of
                switch (e.target.parentNode.id)
                {
                    case "Key_l":
                        gauging_01.focus()
                        gauging_01.innerText= ""
                        break;
                    case "BBQ":
                        gauging_11.focus()
                        gauging_11.innerText= ""
                        break;
                    case "Time_Set":
                        speech_Item_p2.focus()
                        speech_Item_p2.innerText= ""
                        break;
                    case "A_Report":
                        !korone?AutoReport(time):Report_SET_2_p.innerText="don't click repeatedly"//Modify to your language
                        //!korone?AutoReport(time):Report_SET_2_p.innerText="不要重复点击"//Modify to your language
                        break;
                    case "report_":
                        if(!tipoff) return
                        arof?arof=0:arof=1
                        of=arof?"report":"cancel";//Modify to your language
                        arof?Report_SET_1.innerText="Mode:("+of+")":Report_SET_1.innerText="Mode:("+of+")"
                        break;
                }
            }
        }
        SettingItem.onmouseover = function(e){
            if(e.target.nodeName=="SPAN"){
                switch (e.target.parentNode.id)
                {
                    case "Key_l":
                        shion_p.innerText= "Set a number greater than 10 "//Modify to your language
                        //shion_p.innerText= "设置大于10的数 "//Modify to your language
                        break;
                    case "BBQ":
                        shion_p.innerText= "Set a number greater than 2 and less than 17 "//Modify to your language
                        //shion_p.innerText= "设置小于2大于7的数字 "//Modify to your language
                        break;
                    case "Time_Set":
                        shion_p.innerText= "Set the interval, too fast will be judged as a robot"//Modify to your language
                        //shion_p.innerText= "设置间隔,过快可能被判定为机器人"//Modify to your language
                        break;
                    case "A_Report":
                        shion_p.innerText= "Report the following spam every "+time+" ms"//Modify to your language
                        //shion_p.innerText= "开启后以3秒/条的速度举报下面的发言"//Modify to your language
                        break;
                    case "report_":
                        e.target.id == "ReportSET"&&tipoff?shion_p.innerText= "Click to toggle Report or Cancel ":shion_p.innerText= "If the calling function is not normal, restart it again "//Modify to your language
                        //e.target.id == "ReportSET"&&tipoff?shion_p.innerText= "点击切换举报行为:举报/取消 ":shion_p.innerText= "如果自动发言不工作了就重开一次快速举报 "//Modify to your language
                        break;
                }
            }
        }
        speech_Item_p2.onblur = ()=>{
            let x=speech_Item_p2.innerText
            typeof parseInt(x)=="number"&&x!=""&&!isNaN(parseInt(x))?Time=Math.abs(parseInt(x))*1000:Time= Time
            localStorage.setItem("Time",Time)
            speech_Item_p2.innerText=Time/1000
        }
        gauging_01.onblur = ()=>{
            let x=gauging_01.innerText
            let xx=parseInt(x)
            typeof xx=='number'&&x!=""&&!isNaN(xx)&&Math.abs(xx)>10?Key_l=Math.abs(xx):Key_l= Key_l
            gauging_01.innerText=Key_l
            localStorage.setItem("Key_l",Key_l)
        }
        gauging_11.onblur = ()=>{
            let x=gauging_11.innerText
            let xx=parseInt(x)
            typeof xx=='number'&&x!=""&&!isNaN(xx)&&Math.abs(xx)>2?BBQ=Math.abs(xx):BBQ= BBQ
            gauging_11.innerText=BBQ
            localStorage.setItem("BBQ",BBQ)
        }
        //===================================================filter================================================================================
        let Null_div = document.createElement("div");
        Null_div.style.display = "none";
        Yagoo = new MutationObserver((Guestbook) => {
            Guestbook.forEach(function (MessageList) {
                MessageList.addedNodes.forEach(function (node) {
                    if (node.nodeName!="YT-LIVE-CHAT-TEXT-MESSAGE-RENDERER"||node.nodeName=="DIV")return;
                    const Messages_EL = node.querySelector("#message");
                    const Tname = node.querySelector("#author-name");
                    const may = node.querySelector("#chip-badges").children.length;
                    if (!Tname||!Messages_EL||may) return;
                    let Tname_T = Tname.innerText
                    if (Tname_T==myname&&tipoff) return;
                    if (S_Username.length > 0) ctm += 1;
                    if (ctm >= BBQ || S_Username.length >= BBQ) {
                        S_Username.shift()
                        ctm = 0
                    }
                    const Cdk = Messages_EL.innerText.replace(re, "")
                    let Cdk_l = Cdk.length
                    if(Cdk_l < Key_l){
                        if(Ch_m<30)Ch_m += 1
                        return
                    }
                    if (node.querySelector("#card") || node.querySelector(".member")) return;
                    let Key_On = false,Peko = false
                    wait = (Math.floor(Math.random() * 3100)+100)
                    let get_time =new Date().getSeconds()
                    if(Ch_n<17)Ch_n += 1
                    let EN_off=/^[a-zA-Z0-9]+$/g
                    if (EN_off.test(Cdk)) return
                    Keylist_trun.length&&Keylist_trun.some((item)=>{
                        Key_On = new RegExp(item).test(Cdk)
                        return Key_On
                    })
                    Peko = Anemati.includes(Tname_T)
                    let cdk = GetKey(Cdk)
                    Messages_EL.style.display="none"
                    let zoo = document.createElement("span");
                    zoo.id = "ZOO"
                    let salu= Zoo()
                    zoo.innerHTML = salu
                    Messages_EL.before(zoo)
                    if (Key_On) {
                        let TNT=Null_div.cloneNode()
                        Itemslist.appendChild(TNT)
                        Report(node,cdk,key_i(cdk))
                        Ch_n=0
                        Ch_m=0
                        if (TTK&&outtime)autocall(wait,Time,false)
                        return
                    } else if (Peko) {
                        let TNT=Null_div.cloneNode()
                        Itemslist.appendChild(TNT)
                        AddKey_List(cdk,Cdk)
                        Report(node,cdk,key_i(cdk))
                        Ch_n=0;
                        Ch_m=0;
                        if (TTK&&outtime)autocall(wait,Time,false)
                        return
                    } else if (!Key_On && !Peko) {
                        if (S_Username.includes(Tname_T)&&Ch_n<=BBQ&&Ch_m<=BBQ) {
                            Anemati.push(Tname_T)
                            Peko = true
                            let TNT=Null_div.cloneNode()
                            Itemslist.appendChild(TNT)
                            AddKey_List(cdk,Cdk)
                            setTimeout(()=>{pekoname(Tname_T,Cdk)},500)
                            Report(node,cdk,key_i(cdk))
                            Ch_n=0
                            Ch_m=0
                            if (TTK&&outtime)autocall(wait,Time,false)
                            return
                        }else{
                            S_Username.push(Tname_T)
                            let TNT=Null_div.cloneNode()
                            Itemslist.appendChild(TNT)
                            AddItems(node,Tname_T,Key_On,Ch_m,get_time)
                            Ch_n=0
                            Ch_m=0
                            AddKey_List(cdk,Cdk)//All long speeches are listed as keywords If you don't like it, log it out  不喜欢就注销这行
                            if (TTK&&outtime)autocall(wait,Time,false)
                            return
                        }
                    }
                });
            });
        });
        Yagoo.observe(Itemslist, {
            childList: true,
        });
        end=function end() {
            Yagoo.disconnect()
            Yagoo=null
            imgset = null
            AddItems = null
            Report = null
            pekoname = null
            AutoReport = null
            New_Chat.onmouseover = null
            New_Chat.onclick = null
            Auto_mes_L.onclick = null
            Auto_mes.onmouseleave = null
            Auto_mes_O.onmouseover = null
            Auto_mes_O.onclick = null
            Auto_mes_R.onclick = null
            Report_key_mes.onclick = null
            Report_SET_0_Input.onclick = null
            Report_SET_2_p.onclick = null
            Settinglist.onclick = null
            Add_Button.onclick = null
            Add_Input_Key.onfocus = null
            Re.onclick = null
            Del_Button.onclick = null
            Auto_mes_O_P.onclick= null
            gauging_01.onblur = null
            gauging_11.onblur = null
            Important_Frame.remove()
            Re.remove()
            counter.remove()
            Report_l.remove()
            Auto_mes_O_P.remove()
            counter=null
            Report_l=null
        }
    }
    //end//
    let sb = document.getElementById("send-button")
    let button = new MutationObserver((node) => {
        let DT = document.getElementById("TTi")
        color == "#4b4b4b" ?DT.style.color ="#ffffffa8":DT.style.color ="#0000006e"
        if (!node[0].target.getAttributeNode("countdown-active")){
            DT.style.color =""
            DT.innerText = "Ready(slow mode)"//Modify to your language
            Interval=null
        }else{
            DT.innerText = "Waiting(slow mode)";
            window.clearInterval(Interval);
        }
    });
    sb&&button.observe(sb,{attributes: true});
    function report_set() {
        let body_ = document.querySelector("body")
        let Mumei =document.querySelector("yt-live-chat-app")
        let Report_SET = new MutationObserver((node) => {
            for (let item of node){
                for (let op of item.addedNodes){
                    switch (op?.children[0]?.nodeName)
                    {
                        case "YT-REPORT-FORM-MODAL-RENDERER":
                            Report.disconnect()
                            Report.observe(op,{attributeFilter:[ "style"],})
                            break;
                        case "YT-CONFIRM-DIALOG-RENDERER":
                            Report_Ok.disconnect()
                            Report_Ok.observe(op,{attributeFilter:[ "style"],});
                            break;
                        case "DIV":
                            if(op?.children[0].children[0].nodeName!="YTD-MENU-POPUP-RENDERER") return
                            Report_fram.disconnect()
                            Report_fram.observe(op,{attributeFilter:[ "style"],});
                            break;
                    }
                }
            }
        });
        Report_SET.observe(Mumei, {
            childList: true,
        });
        let Report_black = new MutationObserver((node) => {
            if (!tipoff) return
            for (let item of node){
                for (let op of item.addedNodes){
                    if (op.nodeName=="TP-YT-IRON-OVERLAY-BACKDROP")op.remove()
                }
            }
        });
        Report_black.observe(body_, {childList: true,});
        let Report_fram = new MutationObserver((E) => {
            if (!tipoff) return
            let Yes=E[0].target
            if (Yes.style.display!="none"){
                let R_Box = document.querySelector("ytd-menu-service-item-renderer")
                Yes.style.display="none"
                if(Achan){Achan.querySelector("#message").style.color=color_ames+"80"}
                R_Box&&R_Box.click()
            }
        });
        let Report_Ok = new MutationObserver((E) => {
            if (!tipoff) return
            let OK=E[0].target
            if (OK.style.display!="none"){
                // OK.style.display="none"
                OK.querySelector("#confirm-button").children[0].children[0].click();
                if(Achan)Achan.remove()
                nethe++
                Achan=null
                error=null
                log1.innerText = nethe
            }
        });
        let Report = new MutationObserver((E) => {
            if (!tipoff) return
            let Fubuki= E[0].target
            if (Fubuki.style.display!="none"){
                const menu = document.querySelector(".radio.style-scope.yt-options-renderer")
                menu.click()
                menu.setAttribute('class', 'radio style-scope yt-options-renderer iron-selected')
                menu.setAttribute('aria-checked', 'true')
                menu.setAttribute('aria-selected', 'true')
                menu.setAttribute('checked', '')
                menu.setAttribute('active', '')
                menu.setAttribute('focused', '')
                if(Achan&&arof){
                    Achan.querySelector("#message").style.color=color_ames+"30"
                }else if(Achan&&!arof){
                    Achan.style.display="none"
                }
                let x = Fubuki.children[0]?.children[3]?.children;
                Fubuki.style.display="none"
                let ev=arof?x[1]:x[0]
                ev.click()
            }
        });
    }
    function autocall(wait,Time,limit){
        if (!Interval&&outtime){
            Time=Time||localStorage.getItem("Time")
            outtime=0
            const fram = document.querySelector("#mes_box").children
            let mes_i=Math.floor(Math.random()*fram.length)
            let none2 = fram[mes_i]?.innerHTML||"kawaii"
            Bchan=limit
            setTimeout(function(){
                if (!Bchan)Bchan = Ch_m<spam
                Bchan&&call(none2)
            },wait)
        }
    }
    function localItem(){
        const load_mes = document.querySelector("#mes_box").children
        let item_j=""
        for (let item of load_mes){
            let t=item.innerHTML
            item_j?item_j=item_j +"|" + t :item_j=item_j + t
        }
        localStorage.setItem("IMGitem",item_j)
    }
    function call(none){
        let iv=document.querySelector("DIV#input")
        if (!iv) return
        let ie= new InputEvent("input")
        iv.innerHTML= none
        iv.dispatchEvent(ie);
        document.querySelector("yt-button-renderer.yt-live-chat-message-input-renderer").click()
        let DT = document.getElementById("TTi")
        color == "#4b4b4b" ?DT.style.color ="#ffffffa8":DT.style.color ="#0000006e"
        let DT_time=Time/1000
        DT.innerText = "Waiting"
        Interval=setInterval(()=>{
            if (DT_time==0){
                DT.innerText="Ready"//Modify to your language
                window.clearInterval(Interval);
                Interval=null
                outtime=1
            }else{
                DT_time -=1
                DT.innerText = "Waiting\("+DT_time+"\)Sec"
            }
        },1000)
    }
    function img(){
        const fram = document.querySelector("#img_box")
        if (fram.children.length)return
        const iron = document.querySelector("iron-pages#pickers")
        const img = iron.querySelectorAll("div#emoji")
        let x
        img.length==9?x=1:x=2
        for (let i= 1,l=img.length;i<l;i++){
            if (i == x)continue
            ((t)=>{
                let img_new=img[t].cloneNode(true)
                setTimeout(()=>{fram.appendChild(img_new)},t*1000)
            })(i)
        }
    }
    function iron_load(){
        let iron_box= document.querySelector("yt-live-chat-icon-toggle-button-renderer#emoji.yt-live-chat-message-input-renderer")
        if(!iron_box)return
        iron_box= iron_box.querySelector("yt-interaction#interaction.yt-icon-button")
        iron_box.click()
        iron_box.click()
        setTimeout(()=>{img()},6000)
    }
    function DellArray(V,Array){
        for (let i= Array.length-1;i>=0;i--){
            if(Array[i]==V){
                Array.splice(i, 1)
            }
        }
    }
    window.onbeforeunload = function(){
        let key=document.getElementById("keys")
        if(key.value!=""){
            navigator.clipboard.writeText(key.value).then(() => {});
        }
    }
    function AddKey_List(cdk,Cdk){
        Keylist_trun.push(cdk)
        Keylist.push(Cdk)
        Keylist=Array.from(new Set(Keylist));
        Keylist_trun=Array.from(new Set(Keylist_trun));
    }
    function GetKey(en) {
        let items=Array.from(en,(x,i)=>i===0?x:".*"+x).join("")
        return items
    }
    function key_i(cdk){
        for (let i=0,l=Keylist_trun.length;i<l;i++) {
            let reg_kkey = new RegExp(Keylist_trun[i]);
            if (reg_kkey.test(cdk)) {return i}
        }
    }
    function ChatCheck(){
        let cc= document.querySelectorAll(".chenk")
        for (let item of cc){
            if (item.id>10) item.remove()
        }
    }

    function Zoo(){
        let zoo=[]
        zoo[0]='<img src="https://www.youtube.com/s/gaming/emoji/828cb648/emoji_u1f49e.svg"  style="vertical-align: middle; margin:-1px 2px 1px" width="24" height="24">'
        zoo[1]='<img src="https://www.youtube.com/s/gaming/emoji/828cb648/emoji_u1f44f.svg"  style="vertical-align: middle; margin:-1px 2px 1px" width="24" height="24">'
        zoo[2]='<img src="https://www.youtube.com/s/gaming/emoji/828cb648/emoji_u1f970.svg"  style="vertical-align: middle; margin:-1px 2px 1px" width="24" height="24">'
        zoo[3]='<img src="https://www.youtube.com/s/gaming/emoji/828cb648/emoji_u263a.svg"  style="vertical-align: middle; margin:-1px 2px 1px" width="24" height="24">'
        zoo[4]='<img src="https://www.youtube.com/s/gaming/emoji/828cb648/emoji_u1f606.svg"  style="vertical-align: middle; margin:-1px 2px 1px" width="24" height="24">'
        zoo[5]='<img src="https://www.youtube.com/s/gaming/emoji/828cb648/emoji_u1f60d.svg"  style="vertical-align: middle; margin:-1px 2px 1px" width="24" height="24">'
        let i=Math.floor(Math.random()*6)
        let b=zoo[i]+zoo[i]
        for(let n=0;n<=Math.floor(Math.random()*2);n++){
            b+=zoo[i]
        }
        return b
    }
    const Start = GM_registerMenuCommand("On/Off:Click to restart", () => {//Modify to your language
        ONOff?ONOff=false:ONOff=true
        if(ONOff){
            launch()
        }else{
            end&&end()
            end=null
        }
    });
    setTimeout(()=>{report_set()},2000)
})();