Greasy Fork is available in English.

斗鱼自动搜火力+发AI弹幕+极速签到=抢鱼丸红包沙发神器(日进2W丸子,有图为证)

这里有斗鱼真正全自动搜索🧐火力全开+自动发AI智能弹幕的抢鱼丸红包二合一的神级😇脚本,您安装脚本后,需要做的只需要两步,一是功能选择💥弹幕轰炸,二是打开鱼吧右侧的二合一开关,然后就不需要您的任何操作了,自动参与火力全开发弹幕抢丸子红包的事情都交给脚本帮你搞定。进来体验下土豪玩家💰😎💰的感脚吧,让您做一个真正有牌面的斗鱼白嫖看客,幻神弹幕特效-有撒,满级粉丝牌子-有撒,顶级车队logo-有撒,极速签到手速王-还是有撒,茫茫人海一眼就相中这个主播,大手🖐一挥,鱼丸万两——💲赏💲!睥睨水友、笑傲鱼塘、彪炳平台全都有撒🐷~!

您查看的为 2019-10-16 提交的版本。查看 最新版本

// ==UserScript==
// @name         斗鱼自动搜火力+发AI弹幕+极速签到=抢鱼丸红包沙发神器(日进2W丸子,有图为证)
// @namespace    https://github.com/wolf-scream
// @version      0.5.5
// @description  这里有斗鱼真正全自动搜索🧐火力全开+自动发AI智能弹幕的抢鱼丸红包二合一的神级😇脚本,您安装脚本后,需要做的只需要两步,一是功能选择💥弹幕轰炸,二是打开鱼吧右侧的二合一开关,然后就不需要您的任何操作了,自动参与火力全开发弹幕抢丸子红包的事情都交给脚本帮你搞定。进来体验下土豪玩家💰😎💰的感脚吧,让您做一个真正有牌面的斗鱼白嫖看客,幻神弹幕特效-有撒,满级粉丝牌子-有撒,顶级车队logo-有撒,极速签到手速王-还是有撒,茫茫人海一眼就相中这个主播,大手🖐一挥,鱼丸万两——💲赏💲!睥睨水友、笑傲鱼塘、彪炳平台全都有撒🐷~!
// @author       lvlanxing
// @supportURL   https://github.com/wolf-scream/FirePowerSeek
// @icon         https://raw.githubusercontent.com/popzoo/pop/master/images/favicon.ico
// @include      https://www.douyu.com/0*
// @include      https://www.douyu.com/1*
// @include      https://www.douyu.com/2*
// @include      https://www.douyu.com/3*
// @include      https://www.douyu.com/4*
// @include      https://www.douyu.com/5*
// @include      https://www.douyu.com/6*
// @include      https://www.douyu.com/7*
// @include      https://www.douyu.com/8*
// @include      https://www.douyu.com/9*
// @include      https://www.douyu.com/topic/*
// @include      https://www.douyu.com/*?rid=*
// @match        https://yuba.douyu.com/*
// @match        https://msg.douyu.com/*
// @mail         lvlanxing@gmail.com
// @copyright    JadeBone
// @grant        none
// @compatible   chrome
// @run-at       document-end

// @note         本脚本包含主要功能:本脚所包含的所有功能:自动搜索火力全开房间+自动随机发送云端弹幕+极速签到手速王+皇帝弹幕特效+不绑定手机发弹幕+房间自动签到+房间已签到排行+房间在线人数+当日跳转次数+平台礼物数量+主播信用值+主播开播时长+是否自动播放(记忆上次操作)+关闭滚屏弹幕(记忆上次操作)+画质调整(自行开启)+抓取幻神弹幕特效(自行开启)等功能 && Main Function of Script:Auto Fire Power Seek + Auto Barrage Bombing + Royal Barrage Effect + Sent Barrage Without Binding Phone + Room Assign + Online People Number + Jumping Page Times + Anchor Credit + Anchor Living Time and so forth;
// @note         本脚本完全由原生的JS写成,且好多函数代码模块可以独立使用(比如非绑定手机发弹幕函数),用户完全可以不装tampermokey或violentmonkey,直接复制代码在控制台执行;
// @note         欢迎大家使用、参考、研究和引用本脚本,但在引用脚本的时候,希望您能标注出处,这也是对博主的认可和尊重,也是自我修养的体现,如果有什么意见欢迎给博主发邮件留言;
// @note         需要警惕😱的是,当自动搜素🌐跳转房间超过100次时,您处于高危状态,随时会被斗鱼系统屏蔽🚫弹幕发言,不过不要紧哈,当自动跳转超100次会限制自动跳转页面功能,用户可以自行手动跳转;
// @note         V0.1.0 根据斗鱼鱼塘任务的接口,实现手动按钮火力房间搜索并跳转;
// @note         V0.1.1 火力搜寻的网址跳转计数,按日期形式序列化到localStorage中,方便用户统计查看;
// @note         V0.1.2 清理localStorage中无用的信息,同时也防止斗鱼收集用户行为信息;
// @note         V0.1.3 增加火力全开房间的筛选,热度筛选,当房间热度太高>50W 弹幕中奖几率低则跳过;
// @note         V0.1.4 奖品种类筛选,只有符合鱼丸和红包奖励才参与,鱼丸奖品份数要大于2,每个不低于100丸子,红包过滤常见无效的金额数目(0.01,0.1,0.5元)
// @note         V0.1.5 参与条件筛选,是否需要成为粉丝才可以参与,如需要粉丝,则跳过;
// @note         V0.1.6 禁言判断,如果之前被正浏览的房间禁言,则自动跳转;
// @note         V0.1.7 增加画质调整,因为是抢丸子,所以默认为最低画质,函数中也带了最高画质的代码,可自行注掉更换,该方法参考greaseFork中wah0713大神的方法实现,在此拜谢!
// @note         V0.2.0 增加自动按钮的UI按钮和样式radio,实现手动自动自由切换的方案,由你喜好决定;
// @note         V0.2.1 增加复选框radio的记录功能,序列化localStorage,记录上次跳转的操作,如果是自动,则一直会筛选到符合的房间为之,如果错过房间想停止,你在程序初始化显示界面后有3s的时间选择,点击⛔火力停止单选框,即可停留界面;
// @note         V0.2.2 添加满足筛选条件的当前房间自动关注与房间签到功能,毕竟都抢人红包或丸子了,给个关注应该的,也方便以后继续抢哈……
// @note         V0.2.3 添加默认关闭滚屏弹幕方法,用户可按需要在尾部主函数中注掉或打开此方法;
// @note         V0.2.4 添加默认关闭自动视频播放的方法,用户可按需要在尾部主函数中注掉或打开此方法;
// @note         V0.2.5 增加获取用户ID和用户昵称的函数,并序列化localStorage中,方便标识不同用户数据统计;
// @note         V0.2.6 增加获取当前房间的roomId,方便后续的json的URL请求和粉丝牌的logo寻找提供条件;
// @note         V0.2.7 添加显示当前直播间在线人数,这个功能也是挺不错了,但也有不准的地方,仅供参考,该方法参考greaseFork中qianjiachun大佬公布的斗鱼API接口实现的,在此拜谢!
// @note         V0.2.8 添加显示当前房间的信用值,满为12,最低为4,当信用<4,水友们无法送礼物给主播了;
// @note         V0.2.9 添加不绑定手机号发弹幕(前提是必须是其他账号登陆状态,非登陆状态不行),这个功能还是挺不错,如果想搞小号抢丸子,这个挺方便的,看来斗鱼还是给手机号不足的用户留条后路的;
// @note         V0.3.0 增加超级皇帝的聊天弹幕特效:包括帝王图标,当前房间的满级粉丝牌30,等级满级120,当前房间满级16,炫酷车队logo-皇,签到手气王;
// @note         V0.3.1 增加超级皇帝的滚屏弹幕特效,绑定键盘回车和鼠标点击弹幕发送按钮,当用户发弹幕会自动触发,延迟300ms后自动改为皇帝弹幕特效,网络好可以改成200ms,或150ms
// @note         V0.3.2 增加抓捕幻神弹幕特效的自动方法,如果朋友您在localStorage方法看到两个🍅🥦🍅打头的键值,如果数据可用,或者您是前端大神,希望您把抓获的野生纯种幻神弹幕特效邮件发给博主,虽然不能享受RMB的幻神待遇,但本机满足下幻神的体验还是很棒的事情;
// @note         V0.3.3 添加皇帝弹幕王者神豪的动态logo特效,修正了一些log的日志级别,增加了房间签到时间延迟,防止出现没关注就签到的无效情景;
// @note         V0.3.4 增加了网址跳转前的房间过滤功能,自动过滤掉二次元、看电影和人数>2500的房间,提高搜索效率,增加topic/*专题房间的网址匹配;
// @note         V0.3.5 增加了当前直播间主播已经开启直播时间的计时,单位/分钟,增加了当前浏览器弹幕系统(包含竞猜的实时赔率显示)的延迟时间显示,单位/毫秒,增加了鼠标悬浮此区域的文字提示tip说明;
// @note         V0.3.6 修改了脚本加载的固定时间,改为根据用户端的网络的页面加载进度自动执行脚本初始化,去除了上方弹幕延迟数据90ms(无意义),增加了当前房间的签到排行显示,便于用户抢签到手气王,需要注意处于开火仍执行自动房间签到,停火才能手动签到,最多显示签到人数100+;
// @note         V0.3.7 增加弹幕轰炸功能,当前房间符合火力全开搜索条件时,则自动发送弹幕抢奖品,弹幕发送时间算法是当前房间的自己已经发送弹幕间隔数和房间的热度值段联合决定的,不需要用户自定义,弹幕内容为普通候选弹幕。待完成:后期会增加联网云弹幕,自动判定当前房间类型有针对发送合适弹幕!
// @note         V0.3.8 增加云端弹幕功能,根据当前房间的二级分类标题,选取符合房间类别的弹幕,随机选取后自动发送.修复自动火力搜索火力按钮无法跳转的bug,增加云弹幕json接口的访问频次统计,暂时没有限定云弹幕的访问,如果频次过高,则后续做本地缓存处理;去除签到手气王标志,与王者神豪不协调;
// @note         V0.3.9 增加滚屏弹幕和自动播放的记忆功能,即如果用户关闭过滚屏弹幕,则用户跳转新直播间,滚屏弹幕仍保持关闭状态,自动播放功能也如此。这样方便满足大家在不同场景的不用需要,也避免了增加按钮开关的繁琐操作;
// @note         V0.4.0 优化房间自动签到的功能,初始化脚本后即可自动签到,修复在无火力全开情况下无自动签到的问题;
// @note         V0.4.1 新增arrPoetry精选弹幕,与云精选弹幕混合使用,精选弹幕的随机使用比例为1/5,普通弹幕的随机使用比例为4/5,大家可以F12在控制台查看是普通弹幕还是精选弹幕类型;
// @note         V0.4.2 新增极速签到功能,直接调用签到API接口,检测到主播开播后极速签到,延迟为ms级别,使用此功能记住一定要将主播加入特别关注,否则无法获取主播开播状态,由于此功能对服务器压力较大,建议最好在主播开播前几分钟使用;
// @note         V0.4.3 修复鱼丸筛选丸子>1000时自动跳转的bug, 新增斗鱼车队条件筛选功能,方便大家去低门槛车队去周转丸子。修改礼物展示的界面,增加下拉加载功能等;
// @note         V0.4.4 新增鱼吧自动签到鱼吧收藏列表的所有鱼吧,没有上限,只要是你收藏的鱼吧就可以,使用方法soEasy,可以在任意直播间下拉,等待下面的鱼吧帖子自动加载上就可以自动签到了,也可直接进入鱼吧主界面签到,签到完成后会有弹窗提示,每天只执行一次;
// @note         V0.4.5 修复极速自动签到cookie为空引发的无法签到的问题,大家这回不用去其他任意直播间签到了,脚本自动设置签到cookie参数直接赋值就可以,又方便了大家,哈哈;
// @note         V0.4.6 新增幻神弹幕功能,含泪呀,拖了二个多月,别人家都做出来,博主一直懒得搞,这回好了,直接抓特效就好了,以后大家都是幻神大大了;
// @note         V0.4.7 新增车队一键签到,只要是打开车队的界面,就可以自动签到了!又解放了大家的双手,懒人都笑了有木有;
// @note         V0.4.8 去除了签到排行的排名显示功能, 因为这个接口的数据是被斗鱼延迟处理的,不是实时的数据,所以没有太大的意义,以后签到全部改为自动签到(包括在⛔火力停止的时候也自动签到);
// @note         V0.5.0 增加智能聊天机器人-小思,拥有亿级别的实体属性关系,机器人具备的功能有:中文分词、词性标注、命名实体识别、关键词提取、文本摘要、新词发现、情感分析等。缺点是应对某些词汇还是无法识别(如不理解‘吃鸡’等),容易暴露自己,目前在适用,后期要进行特定场景的语义训练;
// @note         V0.5.1 修改了界面UI提示效果,增加用户体验的友好性,之前一直没时间做界面优化,这回有时间一并优化改好,大家这回也不用总开控制台查看程序运行的状态了!
// @note         V0.5.2 增加了全平台车队的数目统计,点击可以进入车队入口,每天自动执行一次页面签到,大家可以通过礼物的入口查看"车队展"来找不限制的车队加入,领取车队加油卡;
// @note         V0.5.3 二合一脚本和安全脚本统一放到一个脚本中了,开启二合一功能开关且停留💥弹幕轰炸处,会自动搜索火力全开并发送弹幕,每天跳转页面超过100次后,则停止自动跳转,但可手动🧐或自动🔥开火跳转,温馨提示:频繁跳转(100+次)+频繁发弹幕=容易被封;
// @note         V0.5.4 填了好多的坑,之前时间匆忙上线,然后有些逻辑没来得及测试,这回一一都填了,欢迎大家随时反馈新的bug;
// @note         V0.5.5 过滤了机器人一些弱智的聊天对话,限制回答弹幕的识别长度,修复了toast若提示闪屏的问题,增加二合一开关的粉丝成员抽奖过滤;
// ==/UserScript==


function roomScript() {
    //=============================================================================
    //++++++++++本地常用普通弹幕,大家可以根据自己喜好修改一些通用的弹幕+++++++++++
    //=============================================================================
    var arrCommon = ["主播加油💪","好奈斯","点击关注,不会迷路","弹幕冲鸭冲鸭","我来冒个泡","火力全开暴躁起来","小礼物刷起来","一发入魂","支持主播,来办卡吧",
                     "神奇的主播,优质的弹幕","水军来捧,主播威猛","铁粉驾到,热度必爆","自家人,别误伤","主播贼6!","กิิิิิ荧กิิิิิิิิิิิ光กิิิิิิิิิิิ棒กิิิิิ"]; //普通本地弹幕,与云普通弹幕混用
    var arrPoetry =["山重水复疑无路,关注主播不迷路!","大风起兮云飞扬,弹幕冲兮人满房!","海阔凭鱼跃,弹幕满屏飞!"];//精选弹幕占位,与云精选弹幕混用
    const royalTime = 300;//单位ms,发送弹幕后更改皇族的时间间隔,网络延迟大则增加此数值 ,反正则减小,不建议小于100 ;
    const sendGap = 150;//单位ms,这个数值是检测主播开播状态的时间间隔,不建议小于100;
    var tmGap = 10000;//默认弹幕时间间隔与轮询间隔 ms
    var msgTxt, msgBtn, firePowerTime,fireSeekJump,popLoopTime,statusInterval;//延迟任务对象
    var uid = "-", uname="-", roomId="99999";//用户id,昵称,房间号
    var sbts = (new Date()).getTime();//当前时间戳
    var radioStorage = "ceaseFire";//初始化单选框状态
    var randomFlag = true;

    //=============================================================================
    //++++++++++++++++++++++云端获取弹幕,暂时不启用本地缓存+++++++++++++++++++++++
    //=============================================================================
    function cloudBarrage(){
        var categoryName = document.getElementsByClassName("Title-categoryItem")[1];
        categoryName = categoryName.innerText;
        fetch('https://raw.githubusercontent.com/popzoo/barrage/master/danmu.json',{
            method: 'GET',
            mode: 'cors', //请求模式为跨域
            cache: 'default', //no-cache
            credentials: 'omit', // 同源则加入凭据头,cookies
        }).then(res => {
            return res.json();
        }).then(json => {
            arrCommon = json.data.通用!=undefined ? arrCommon.concat(json.data.通用) : arrCommon;
            arrCommon = json.data[categoryName]!=undefined ? arrCommon.concat(json.data[categoryName]) : arrCommon;
            arrPoetry = json.data.精选!=undefined ? arrPoetry.concat(json.data.精选) : arrPoetry;
        }).catch(err => {
            console.error('请求错误', err);
        })
    }
    //=============================================================================
    //++++++++++++++++++++++获取真实字符串长度,中文2个,英文1个+++++++++++++++++++
    //=============================================================================
    function getRealStrLength(str){
        var realLength = 0, len = str.length, charCode = -1;
        for (var i = 0; i < len; i++) {
            charCode = str.charCodeAt(i);
            if (charCode >= 0 && charCode <= 128){
                realLength += 1;
            }else{
                realLength += 2;
            }
        }
        return realLength;
    }
    //=============================================================================
    //++++++++++++++++++++人工智能聊天功能,1.4亿知识图谱数据走起++++++++++++++++++
    //=============================================================================
    function robotAIChat(msg){
        var wordFilter = ["不","小思","什么","机器人","卡壳了","太深奥","有点懵","智商下线","无法回答","还会更多"]; 
        let appid = "&appid=e231f81cd82f994e2843c870f391ac7c";
        fetch('https://api.ownthink.com/bot?spoken='+msg+appid).then(res => {
            return res.json();
        }).then(json => {
            if(json.message=="success" && json.data.type==5000){
                json = json.data.info.text;//过滤一些AI弱智的回答
                var sendflag = false;
                for(let i=0;i<wordFilter.length;i++){
                    if(json.indexOf(wordFilter[i])>-1){
                        sendflag = true;
                    }
                }
                if(sendflag){
                    bombBarrage();// 这里发普通弹幕 
                }else{
                    msgTxt.value = json;
                    msgBtn.click();
                    console.info("智能AI小思弹幕,时间间隔<"+((new Date()).getTime() - sbts)/1000+"s>【问】" + msg +"【答】" + json);
                    clickBtnEvent();
                }   
            }else{
                bombBarrage();// 这里发普通弹幕
            }
        }).catch(err => {
            bombBarrage();
            console.error('请求错误', err);
        })
    }
    //=============================================================================
    //++++++++++++++++++++抓取弹幕,内容识别为中文则格式化给小思+++++++++++++++++++++
    //=============================================================================
    function captureBarrage(){
        if ( document.getElementsByClassName('Barrage-content').length > 1 ) {
            var danmuCount = 1;
            var barrageArr = document.getElementsByClassName('Barrage-content');
            function loopSeek(){
                var danmuMsg = barrageArr[barrageArr.length-danmuCount].innerText.replace(/\s/g, '');//  replace是去除字符串中的空格,制表,换号符号;
                if(escape(danmuMsg).indexOf( "%u" )!=-1 && getRealStrLength(danmuMsg)>3 && getRealStrLength(danmuMsg)<20 ){//判读是否有中文,escape对字符串进行编码时,字符值大于255的以"%u****"格式存储,大于255的恰好是非英文字符
                    robotAIChat(danmuMsg);
                }else{
                    if(danmuCount<=20){//仅抓取最近20条回复
                        danmuCount++;
                        loopSeek();//回调
                    }else{
                        bombBarrage();
                        return;
                    }
                }
            }
            loopSeek();
        }else{
            bombBarrage();
        }
    }
    //=============================================================================
    //+++++++++++++++++++++++++++++++++弹幕轰炸++++++++++++++++++++++++++++++++++++
    //=============================================================================
    function bombBarrage(){
        var probNum = parseInt(Math.random() * 5);
        if(probNum == 0){
            var num = parseInt(Math.random() * arrPoetry.length);
            console.log("精选弹幕第<"+num+">条,时间间隔<"+((new Date()).getTime() - sbts)/1000+"s>" + arrPoetry[num]);
            msgTxt.value = arrPoetry[num];
            msgBtn.click();
            clickBtnEvent();
        }else{
            var num1 = parseInt(Math.random() * arrCommon.length);
            console.log("普通弹幕第<"+num1+">条,时间间隔<"+((new Date()).getTime() - sbts)/1000+"s>" + arrCommon[num1]);
            msgTxt.value = arrCommon[num1];
            msgBtn.click();
            clickBtnEvent();
        }
    }
    //=============================================================================
    //++++++++++++++++++++++获取自己上次弹幕的位置间隔++++++++++++++++++++++++++++
    //=============================================================================
    function countBarrageGap(num){
        var gapFlag = true;
        var chatList = document.getElementsByClassName("Barrage-listItem");
        for(let i= chatList.length-1; i>-1;i--){
            let lastGap = chatList.length - i -1;
            if(chatList[i].innerHTML.indexOf("is-self")!=-1 ){
                if(lastGap>= num){
                    gapFlag = true;
                    break;
                } else{
                    gapFlag = false;
                    console.info("距自己上条弹幕间隔数:" + lastGap+"/"+num );
                    break;
                }
            }
        }
        return gapFlag;
    }

    // 判断当前房间是否火力全开,自动监听
    function firePowerController() {
        var fireObj = document.getElementsByClassName("FirePowerChatModal-Notice")[0];
        if ( fireObj != undefined && hotFilter() && awardJudge() && !joinCondition() && !banSpeak() ) {
            let num = parseInt(Math.random()*3) + 3; //随机指定3~5条弹幕间隙再发送自己弹幕
            if(radioStorage == "bombFire" && countBarrageGap(num)){
                 randomFlag?bombBarrage():captureBarrage();//小思弹幕是异步所以时间戳内置;
                 randomFlag=!randomFlag; jsonAnalytics(0);
            }else if(radioStorage == "openFire"){
                console.info("火力监测时间间隔:"+ ((new Date()).getTime() - sbts)/1000 + "s");
                sbts = (new Date()).getTime();
            }
        } else {
            console.info("火力停止时间累计:"+ ((new Date()).getTime() - sbts)/1000 + "s" );
            if((radioStorage == "openFire" || (radioStorage == "bombFire" && localStorage.getItem("switchStatus🏮🎎🏮")=="on")) 
            && ((new Date()).getTime() - sbts) > 1000 * 80 && localStorage.getItem((new Date()).toLocaleDateString() + "📱🌐📱[" + uname + "]") <100){//如果超过*分钟没有开火,则跳转!
                popupToast("《火力搜寻跳转》<br>该房间已经超过80s没重开火力<br>3秒后自动跳转!", 3);
                fireSeekJump = setTimeout(randomFireRequest,3000);
            }
        }
        randomTime();//回调随机时间
    }

    //随机时间差
    function randomTime(){
        let tmRandom = tmGap + parseInt(Math.random()*1500);
        firePowerTime = setTimeout(firePowerController, tmRandom);
    }

    //=============================================================================
    //+++++++++++++++++++++++++++++++火力全开房间号搜索++++++++++++++++++++++++++++
    //=============================================================================
    function randomFireRequest() {
        if(localStorage.getItem("switchStatus🏮🎎🏮")=="on" && localStorage.getItem((new Date()).toLocaleDateString() + "📱🌐📱[" + uname + "]")>=100){
            popupToast("《二合一功能受限》<br>今日二合一全自动跳转已达上限(100次)<br>如仍需要跳转请参考二合一开关的提示", 3);
        }else{
            var ajax = new XMLHttpRequest();
            ajax.timeout = 2000;
            ajax.responseType = "json";
            ajax.open('get', 'https://www.douyu.com/japi/firepower/apinc/activeTask/getRecRid', true); //采用异步
            ajax.send();
            ajax.onreadystatechange = function() {
                if (ajax.readyState == 4 && ajax.status == 200) {
                    fireRequestFilter(ajax.response.data);
                }
            }
        }
    }

    // 火力全开房间搜索过滤
    function fireRequestFilter(fireUrl) {
        var myRequest = new Request('https://www.douyu.com/swf_api/h5room/'+fireUrl);
        fetch(myRequest).then(function(response) {
            return response.json().then(function(json) {
                var jsonData = json.data;
                console.info("主播昵称:【"+jsonData.nickname+"】+++在线人数:【" + jsonData.online + "】+++游戏名称:【" + jsonData.game_name+"】+++跳转链接=>https://www.douyu.com/"+fireUrl);
                if (jsonData.online < 5000 && jsonData.game_name.indexOf("一起看") == -1 && jsonData.game_name.indexOf("二次元") == -1 && jsonData.game_name.indexOf("户外") == -1 && jsonData.game_name.indexOf("汽车") == -1) { //筛选条件:过滤二次元、看电影、户外和人数>5000的房间
                    fireUrl = "https://www.douyu.com/" + fireUrl;
                    var dailyPageCount = localStorage.getItem((new Date()).toLocaleDateString() + "📱🌐📱[" + uname + "]");
                    if (dailyPageCount != null ) {
                        dailyPageCount = parseInt(dailyPageCount) + 1;
                        localStorage.setItem((new Date()).toLocaleDateString() + "📱🌐📱[" + uname + "]", dailyPageCount);
                    } else {
                        localStorage.setItem((new Date()).toLocaleDateString() + "📱🌐📱[" + uname + "]", 1);
                    }
                    window.location.href = fireUrl;
                } else {
                    randomFireRequest();//重新获取有火力全开的房间号
                }
            });
        });
    }

    //++++++++++++++++++++++++绑定欧皇弹幕特效++++++++++++++++++++++++
    function clickBtnEvent(){//roles:1:幻神,other:超级皇帝
        sbts = (new Date()).getTime();
        setTimeout(function(){royalChatEffect(1)}, royalTime);
        setTimeout(function(){screenEmpireBarrage()}, royalTime);
    }
    //===============================================================
    //+++++++++++++++++++++++++幻神聊天特性++++++++++++++++++++++++++
    //===============================================================
    function royalChatEffect(roles) {//roles:1:幻神,other:超级皇帝
        let barrageArr = document.getElementsByClassName('Barrage-listItem');
        if (barrageArr.length > 1) {
            var roomFlag = false;
            for (let i = barrageArr.length - 1; i >-1; i--) {
                if (barrageArr[i].lastElementChild != null && barrageArr[i].lastElementChild.innerHTML.indexOf("Barrage-nobleImg") == -1 && barrageArr[i].lastElementChild.innerHTML.indexOf("is-self") != -1) { //非空,去重,找自己
                    //增加单字车队图标,去重
                    if(barrageArr[i].lastElementChild.innerHTML.indexOf("Motor")==-1){
                        var iconTag = document.createElement("span");
                        iconTag.className = "Motor"
                        iconTag.setAttribute("title","中");
                        iconTag.setAttribute("data-motorcade","中");
                        iconTag.setAttribute("style","background-image:url(https://img.douyucdn.cn/data/yuba/admin/2019/01/07/201901071437499042327937962.png)");
                        var iconSpan = document.createElement("span");
                        iconSpan.className = "Motor-flag";
                        iconSpan.innerText = "中"
                        iconTag.appendChild(iconSpan);
                        barrageArr[i].lastElementChild.insertBefore(iconTag,barrageArr[i].lastElementChild.children[1]);
                    }
                    //修改用户等级、房间等级和字幕颜色
                    var userLevelObj = barrageArr[i].lastElementChild.querySelector(".UserLevel");
                    if( userLevelObj!=undefined){
                        userLevelObj.className = "UserLevel UserLevel--120";
                        userLevelObj.setAttribute("title", "用户等级:120");
                    }
                    var roomLevelObj = barrageArr[i].lastElementChild.querySelector(".RoomLevel");
                    if( roomLevelObj!=undefined){
                        roomLevelObj.className = "RoomLevel RoomLevel--17";
                        roomLevelObj.setAttribute("title","房间等级:17");
                        roomFlag=true;
                    }
                    var barrageColorObj = barrageArr[i].lastElementChild.querySelector(".Barrage-content");
                    if(barrageColorObj !=undefined){//弹幕颜色
                        barrageColorObj.className = "Barrage-content Barrage-content--color0";
                    }
                    //如果没有房间等级则创建元素
                    if(roomFlag == false){
                        var roomTag = document.createElement("span");
                        roomTag.className ="RoomLevel RoomLevel--17";
                        roomTag.setAttribute("title","房间等级:17");
                        barrageArr[i].lastElementChild.insertBefore(roomTag,barrageArr[i].lastElementChild.children[1]);
                    }
                    // 增加签到手气王+增加王者神豪特效(已去除签到手气王,和王者神豪不在同行,不优雅)
                    var fireIconObj = barrageArr[i].lastElementChild.getElementsByClassName("FirePowerIcon")[0];
                    var signTag = document.createElement("a");
                    signTag.setAttribute("class","Baby");
                    signTag.setAttribute("data-id","1500000312");
                    // var signIconImg = document.createElement("img");
                    // signIconImg.setAttribute("class","Baby-image js-baby-signMedalClick");
                    // signIconImg.setAttribute("src","https://res.douyucdn.cn/resource/2019/06/27/reward/15fd9177ac85d6e91414e3ea00c2d720.png");
                    // signIconImg.setAttribute("title","签到手气王");
                    // signTag.appendChild(signIconImg);
                    var kingIconImg = document.createElement("img");
                    kingIconImg.setAttribute("class","Baby-image is-achievement");
                    kingIconImg.setAttribute("src","https://sta-op.douyucdn.cn/douyu/3d416f83fb2de6e4e8de5ce4e24b424e4eccc705.gif");
                    kingIconImg.setAttribute("data-achievementid","188");
                    kingIconImg.setAttribute("title","王者神豪");
                    signTag.appendChild(kingIconImg);
                    if( barrageArr[i].lastElementChild.innerHTML.indexOf("Baby-image")==-1 ){//去重
                        fireIconObj!=undefined? barrageArr[i].lastElementChild.insertBefore(signTag,fireIconObj): barrageArr[i].lastElementChild.appendChild(signTag);
                    }
                    //增加猜王图标,不在同水平线,不优雅去除
                    // var guessTag = document.createElement("a");
                    // guessTag.className = "Medal";
                    // guessTag.setAttribute("data-id","1500000230");
                    // var guessImg = document.createElement("img");
                    // guessImg.setAttribute("class","Medal-image");
                    // guessImg.setAttribute("src","//res.douyucdn.cn//resource/2018/03/16/reward/9f192d005a697258371bef79e4550295.png");
                    // guessImg.setAttribute("title","竞猜周榜收益第一名");
                    // guessTag.appendChild(guessImg);
                    // barrageArr[i].lastElementChild.insertBefore(guessTag,barrageArr[i].lastElementChild.children[1]);
                    // 添加粉丝牌,未考虑本身的粉丝牌去除
                    var fansMedalName = document.getElementsByClassName("FansMedal-name")[0];//粉丝牌名称
                    var fansBackgroundImg = document.getElementsByClassName("FansRankList-item FansRankList-item--top")[0];
                    barrageArr[i].className = "Barrage-listItem js-floating-barrage js-fansfloating-barrage";
                    barrageArr[i].lastElementChild.className = "js-fansfloating-barragecont Barrage--paddedBarrage";
                    if(fansMedalName!=undefined && roomId!=undefined && fansBackgroundImg!= undefined ){//当前房间为普通粉丝牌
                        if(fansBackgroundImg.innerHTML.indexOf("background-image:")==-1){
                            var fansTag = document.createElement("div");
                            fansTag.className="FansMedal level-30 js-fans-dysclick Barrage-icon";
                            fansTag.setAttribute("data-rid",roomId);//id与房间号一致
                            var fansSpan = document.createElement("span");
                            fansSpan.className = "FansMedal-name js-fans-dysclick";
                            fansSpan.setAttribute("data-rid",roomId);
                            fansSpan.innerHTML = fansMedalName.innerText;
                            fansTag.appendChild(fansSpan);
                            barrageArr[i].lastElementChild.insertBefore(fansTag,barrageArr[i].lastElementChild.firstElementChild);
                        }else{//当前房间为动态粉丝牌
                            var fansTag1 = document.createElement("div");
                            fansTag1.className="FansMedal is-made js-fans-dysclick Barrage-icon";
                            fansTag1.setAttribute("style", fansBackgroundImg.getElementsByClassName("FansMedal is-made")[0].getAttribute("style") );
                            fansTag1.setAttribute("data-rid",roomId);//id与房间号一致
                            var fansSpan1 = document.createElement("span");
                            fansSpan1.className = "FansMedal-name js-fans-dysclick";
                            fansSpan1.setAttribute("data-rid",roomId);//id与房间号一致
                            fansSpan1.innerHTML = fansMedalName.innerText;
                            fansTag1.appendChild(fansSpan1);
                            barrageArr[i].lastElementChild.insertBefore(fansTag1,barrageArr[i].lastElementChild.firstElementChild);
                        }
                    }else{//当前房间无粉丝牌,则指定一个粉丝牌
                        var fansTag2 = document.createElement("div");
                        fansTag2.className="FansMedal is-made js-fans-dysclick Barrage-icon";
                        fansTag2.setAttribute("style","background-image: url('https://gfs-op.douyucdn.cn/fans_medal_resource/2019/07/12/5a5efaca4d1250413ed9c3c36438f6cb.gif')");//id与房间号一致
                        fansTag2.setAttribute("data-rid","4615502");//id与房间号一致
                        var fansSpan2 = document.createElement("span");
                        fansSpan2.className = "FansMedal-name js-fans-dysclick";
                        fansSpan2.setAttribute("data-rid","4615502");//id与房间号一致
                        fansSpan2.innerHTML = "猪叫团";
                        fansTag2.appendChild(fansSpan2);
                        barrageArr[i].lastElementChild.insertBefore(fansTag2,barrageArr[i].lastElementChild.firstElementChild);
                    }
                    //增加超级皇帝标签,未考虑有其他贵族标志的替换
                    var nobleIconObj = barrageArr[i].getElementsByClassName("Barrage-icon Barrage-noble")[0];
                    if(nobleIconObj==undefined){//贵族图标去重
                        var royalTag = document.createElement("span");
                        var royalImg = document.createElement("img");
                        royalTag.className = "Barrage-icon Barrage-noble";
                        royalImg.className = "Barrage-nobleImg";
                        var nobleImgUrl = roles == 1 ? "//res.douyucdn.cn/resource/2019/08/15/common/4e85776071ffbae2867bb9d116e9a43c.gif" : "//res.douyucdn.cn/resource/2019/08/09/common/3d994a081e5384de14e6893d1d8b94c5.gif";
                        royalImg.setAttribute("src", nobleImgUrl);
                        royalImg.setAttribute("title", roles == 1?"幻神":"超级皇帝");
                        royalTag.appendChild(royalImg);
                        barrageArr[i].lastElementChild.insertBefore(royalTag, barrageArr[i].lastElementChild.firstElementChild);
                    }
                    break;//加中断意味着只修改刚发送临近的一条弹幕,避免循环全部弹幕的资源浪费
                }
            }
        }
    }

    //===============================================================
    //+++++++++++++++++++++++++幻神滚屏特效++++++++++++++++++++++
    //===============================================================
    function screenEmpireBarrage(){
        var fatherNode = document.querySelector(".danmu-6e95c1");
        for(let i = fatherNode.children.length-1;i>=0;i--){
            if(fatherNode.children[i].className.indexOf("noble-bf13ad")==-1 && fatherNode.children[i].innerHTML.indexOf("border: 2px solid rgb(2, 255, 255)")!=-1){//去重,带蓝框为自己
                //父标签更改
                var liStyle = fatherNode.children[i].getAttribute("style");
                let characterLength = liStyle.substring(liStyle.indexOf("translateX(-")+12,liStyle.indexOf("px); transition"));
                let transformLength = liStyle.substring(liStyle.indexOf("transform ")+10,liStyle.indexOf("s linear"));
                let screenOpacity = liStyle.substring(liStyle.indexOf("opacity:")+8,liStyle.indexOf("; z-index:"));
                var characterStyle = "opacity: "+ screenOpacity +"; z-index: 30; background: rgba(0, 0, 0, 0); top: 4px; transform: translateX(-"+ characterLength +"px); transition: transform "+ transformLength +"s linear;"
                fatherNode.children[i].className = "danmuItem-31f924 noble-bf13ad";
                fatherNode.children[i].setAttribute("style",characterStyle);
                //贵族图标  未考虑去重替换
                var nobleImgTag = document.createElement("img");
                nobleImgTag.className = "super-noble-icon-9aacaf";
                nobleImgTag.setAttribute("src","https://shark2.douyucdn.cn/front-publish/live_player-master/assets/images/h1_dcd226.png");
                nobleImgTag.setAttribute("style","margin-left: -57px; margin-top: -4px;");
                fatherNode.children[i].insertBefore(nobleImgTag,fatherNode.children[i].firstElementChild);
                //用户图标
                var userIconTag = document.createElement("img");
                var userIconObj = document.getElementsByClassName("Avatar is-circle")[0];//自己头像
                var fansHeader = document.getElementsByClassName("FansRankList-item FansRankList-item--top")[0];//粉丝头牌头像
                if(userIconObj !=undefined){
                    userIconObj = userIconObj.getElementsByTagName("img")[0].getAttribute("src");
                    userIconTag.setAttribute("src", userIconObj.replace((new RegExp("_middle")),"_small"));
                }else if(fansHeader!=undefined){//这里不使用固定地址头像,防止用户更换头像,地址失效
                    fansHeader = fansHeader.getElementsByTagName("img")[0].getAttribute("src");
                    userIconTag.setAttribute("src", fansHeader.replace((new RegExp("_middle")),"_small"));
                }
                userIconTag.className = "super-user-icon-574f31";
                fatherNode.children[i].insertBefore(userIconTag,fatherNode.children[i].firstElementChild);
                //去除尾部标签
                var tailTag = fatherNode.children[i].getElementsByClassName("afterpic-8a2e13")[0];
                tailTag.remove();
                //更改字幕内容特效
                var textContent = fatherNode.children[i].getElementsByClassName("text-879f3e")[0];
                textContent.className = "super-text-0281ca";
                textContent.setAttribute("style","font-style: normal; font-variant: normal; font-weight: 500; font-stretch: normal; font-size: 23px; line-height: normal; font-family: SimHei, &quot;Microsoft JhengHei&quot;, Arial, Helvetica, sans-serif; color: rgb(255, 255, 255); background: url('https://shark2.douyucdn.cn/front-publish/live_player-master/assets/images/h2_8e5e64.png'); height: 44px;");
                //尾部图标
                var superTailImg = document.createElement("img");
                superTailImg.className = "super-tail-bffa58";
                superTailImg.setAttribute("src","https://shark2.douyucdn.cn/front-publish/live_player-master/assets/images/h3_fd2e5b.png");
                fatherNode.children[i].appendChild(superTailImg);
                //添加开火标签或签到手气王
                var afterpicTag = document.createElement("div");
                afterpicTag.setAttribute("class","afterpic-8a2e13");
                afterpicTag.setAttribute("style","margin-top: 7px; margin-left: -43px;");
                // afterpicTag.setAttribute("style","margin-top: 7px; margin-left: -1px;");
                if(document.querySelector(".FirePowerChatModal-Notice")==undefined){//添加手气王
                    var signImgTag = document.createElement("img");
                    signImgTag.setAttribute("class","afterpic-8a2e13");
                    signImgTag.setAttribute("src","https://shark2.douyucdn.cn/front-publish/live_player-master/assets/images/lucky_c5d02e.png");
                    signImgTag.setAttribute("style","width: 28.8px; height: 28.8px;");
                    afterpicTag.appendChild(signImgTag);
                }else{//添加火图标
                    var fireImg = document.createElement("img");
                    fireImg.setAttribute("class","afterpic-8a2e13");
                    fireImg.setAttribute("src","https://shark2.douyucdn.cn/front-publish/live_player-master/assets/images/hlqk_61648e.svg");
                    fireImg.setAttribute("style","width: 28.8px; height: 28.8px;");//margin-left: -42px;
                    afterpicTag.appendChild(fireImg);
                }
                fatherNode.children[i].appendChild(afterpicTag);
                // textContent.appendChild(afterpicTag);
            }
        }
    }

    //===============================================================
    //++++++++++++++++添加组件的CSS样式和功能按钮显示+++++++++++++++++
    //===============================================================
    function creatBtnTag(){
        // 创建元素样式,优先执行,radio为单选框样式,dfn为tip提示的样式,modle为alert弱提示,mui为开关样式
        var radioStyle = document.createElement('style');
        radioStyle.type = 'text/css';
        radioStyle.innerHTML = (function(){/*
        .radio{display:inline-block;position: relative;line-height: 18px;margin-right: 10px;cursor: pointer;}
        .radio input{display: none;}
        .radio .radio-bg{display: inline-block;height: 18px;width: 18px;margin-right: 5px;padding:;background-color: #45bcb8;border-radius: 100%;vertical-align: top;box-shadow: 0 1px 15px rgba(0, 0, 0, 0.1) inset, 0 1px 4px rgba(0, 0, 0, 0.1) inset, 1px -1px 2px rgba(0, 0, 0, 0.1);cursor: pointer;transition: all 0.2s ease;}
        .radio .radio-on{display: true;}
        .radio input:checked + span.radio-on{width: 10px;height: 10px;position: absolute;border-radius: 100%;background: #FFFFFF;top: 4px;left: 4px;box-shadow: 0 2px 5px 1px rgba(0, 0, 0, 0.3), 0 0 1px rgba(255, 255, 255, 0.4) inset;background-image: linear-gradient(#ffffff 0, #e7e7e7 100%);transform: scale(0, 0);transition: all 0.2s ease;transform: scale(1, 1);display: inline-block;}
        dfn {padding: 0 0.4em;cursor: help;font-style: normal;position: relative;}
        dfn::after {content: attr(data-info);display: inline;white-space: pre-wrap;z-index: 999;border-radius: 4px;position: absolute;top: 22px; left: 0;opacity: 0;width: 310px;font-size: 13px;font-weight: 300;line-height: 1.5em;padding: 0.5em 0.8em;background: rgba(0,0,0,0.8);color: #fff;pointer-events: none;transition: opacity 150ms, top 150ms;}
        dfn::before {content: '';display: block;position: absolute;top: 12px; left: 20px;opacity: 0;width: 0; height: 0;border: solid transparent 5px;border-bottom-color: rgba(0,0,0,0.8);transition: opacity 150ms, top 150ms;}
        dfn:hover {z-index: 200;}
        dfn:hover::after,
        dfn:hover::before {opacity: 1;}
        dfn:hover::after {top: 30px;}
        dfn:hover::before {top: 20px;}
        .model_toast {width: 452px;background: rgba(0,0,0,.5);border-radius: 8px;text-align: center;position: fixed;top: 50%;left: 50%;margin-top: -120px;margin-left: -226px;}
        .model_toast .popup-toast {padding: 38px 40px;text-align: center;font-size: 16px;color: #fff;z-index: 300;}
        .mui-switch {margin:16px 0;width: 52px;height: 31px; position: relative;border: 1px solid #dfdfdf;background-color: #fdfdfd;box-shadow: #dfdfdf 0 0 0 0 inset;border-radius: 20px;border-top-left-radius: 20px;border-top-right-radius: 20px;border-bottom-left-radius: 20px;border-bottom-right-radius: 20px;background-clip: content-box;display: inline-block;-webkit-appearance: none;user-select: none;outline: none; }
        .mui-switch:before {content: '';width: 29px;height: 29px;position: absolute;top: 0px;left: 0;border-radius: 20px;border-top-left-radius: 20px;border-top-right-radius: 20px;border-bottom-left-radius: 20px;border-bottom-right-radius: 20px;background-color: #fff;box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4); }
        .mui-switch:checked {border-color: #64bd63;box-shadow: #64bd63 0 0 0 16px inset;background-color: #64bd63; }
        .mui-switch:checked:before {left: 21px; }
        .mui-switch.mui-switch-anim {transition: border cubic-bezier(0, 0, 0, 1) 0.4s, box-shadow cubic-bezier(0, 0, 0, 1) 0.4s; }
        .mui-switch.mui-switch-anim:before {transition: left 0.3s; }
        .mui-switch.mui-switch-anim:checked {box-shadow: #64bd63 0 0 0 16px inset;background-color: #64bd63;transition: border ease 0.4s, box-shadow ease 0.4s, background-color ease 1.2s; }
        .mui-switch.mui-switch-anim:checked:before {transition: left 0.3s; }
    */}).toString().split('/*')[1].split('*/')[0];
        document.head.appendChild(radioStyle);

        // 创建radio元素标签,后于样式执行,样式独有
        var radioBtnTag = (function(){/*
        <dfn data-info="🧐-手动火力全开房间搜索,用户可以手动点击跳转;⛔-火力停止状态,初始化组件展示数据或停止弹幕;🔥-火力搜寻状态,自动搜索火力全开筛选的房间,火力停止>60s重新搜寻,筛选条件详见脚本更新描述;💥-自动发弹幕,满足🔥的房间,切到💥会自动发弹幕,发送时间智能计算,根据火力有无自动发停,弹幕内容依据房间类别随机从本地与云弹幕库抽取; ⚡-极速签到功能,助您荣登签到手速王榜首,需要把想签到的房间加入“特别关注”,在未开播直播间切到此状态监测,开播则自动极速签到,由于此功能对服务器鸭梨山大,最好在主播临开播前5~10min开启!">
        <label for="ceaseFire" class="radio" id="label_cease_fire">
            <span class="radio-bg"></span>
            <input type="radio" name="radio_fire" id="ceaseFire"  value="⛔" />⛔
            <span class="radio-on"></span>
        </label>
        <label for="openFire" class="radio" id="label_open_fire">
            <span class="radio-bg"></span>
            <input type="radio" name="radio_fire" id="openFire"  value="🔥" />🔥
            <span class="radio-on"></span>
        </label>
        <label for="bombFire" class="radio" id="label_bomb_fire" >
            <span class="radio-bg"></span>
            <input type="radio" name="radio_fire" id="bombFire"  value="💥" />💥
            <span class="radio-on"></span>
        </label>
        <label for="thunderAssign" class="radio" id="label_thunder">
            <span class="radio-bg"></span>
            <input type="radio" name="radio_fire" id="thunderAssign"  value="⚡"/>⚡
            <span class="radio-on"></span>
        </label>
        </dfn>
        */}).toString().split('/*')[1].split('*/')[0].replace(/[\n]/g, '');

        // 创建火力搜寻+发弹幕二合一的控制开关
        let menuNode = document.querySelector(".Header-menu");
        var outLiTag = document.createElement("li");
        outLiTag.className="Header-menu-link";
        let checkedStatus = localStorage.getItem("switchStatus🏮🎎🏮");//获取开关的状态
        var switchContent = "<dfn data-info='二合一功能(火力搜寻+自动弹幕)的控制开关,开启此开关+停留💥弹幕轰炸,会自动搜索火力全开+自动发送弹幕,每天跳转超过100次后,则停止自动跳转;不过关闭此开关仍可手动🧐或自动🔥开火跳转。温馨提示:频繁跳转(100+次)+频繁发弹幕=会被封哟!'>";
        if(checkedStatus=="on"){
            switchContent+="<input class='mui-switch mui-switch-anim' type='checkbox' checked></dfn>";
        }else{
            switchContent+="<input class='mui-switch mui-switch-anim' type='checkbox'></dfn>";
        }
        outLiTag.innerHTML = switchContent;
        menuNode.appendChild(outLiTag);
        // 监听二合一开关事件
        let bilingObj = document.getElementsByClassName("mui-switch-anim")[0];
        bilingObj.addEventListener("change",(function(){switchChange()}));

        // 创建火力寻找跳转按钮,按钮样式依赖斗鱼
        var outSpan = document.createElement("span");
        var fireSeekBtn = document.createElement("button");
        outSpan.className = "Title-blockInline";
        fireSeekBtn.innerHTML = "🧐开火";
        fireSeekBtn.className = "Wallet-content-recharge"; //这个控制按钮样式,如Category-item, BackpackButton,PlayerToolbar-getYCBtn
        fireSeekBtn.addEventListener("click", randomFireRequest);
        var blankTag = document.createElement("span");
        blankTag.innerHTML = "&nbsp;&nbsp;&nbsp;";
        var reportNode = document.querySelector(".Title-headline");//获取锚点
        if(reportNode != undefined){
            outSpan.appendChild(blankTag);//空格占位
            outSpan.appendChild(fireSeekBtn);//开火按钮
            reportNode.appendChild(outSpan);
            // reportNode.parentNode.parentNode.insertBefore(outSpan,reportNode.parentNode);
        }else {
            console.error("未找到标题元素,无法创建【🔥】按钮");
        }

        //这里要先创建radio标签,然后动态添加onchange事件,否则获取不到监听对象
        var sortNode = document.querySelector(".Title-categoryWrap");//获取radio锚点
        var seekTag = document.createElement("div");
        seekTag.className = "Title-anchorInfo";
        seekTag.innerHTML = radioBtnTag;
        if(sortNode !=undefined){
            sortNode.firstChild.append(seekTag);
            sortNode.insertBefore(seekTag,sortNode.firstElementChild.nextSibling);//添加按钮
            var anchor1 = document.getElementById("ceaseFire");
            anchor1.addEventListener("change",(function(){radioChange('ceaseFire');}));
            var anchor2 = document.getElementById("openFire");
            anchor2.addEventListener("change",(function(){radioChange('openFire');}));
            var anchor3 = document.getElementById("bombFire");
            anchor3.addEventListener("change",(function(){radioChange('bombFire');}));
            var anchor4 = document.getElementById("thunderAssign");
            anchor4.addEventListener("change",(function(){radioChange('thunderAssign');}));
            if(localStorage.getItem("switchStatus🏮🎎🏮")=="on"){
                document.getElementById("label_open_fire").style.display="none"; 
                document.getElementById("label_thunder").style.display="none";   
            }
        }else{
            console.error("未找到房间类别元素,无法创建radio单选框");
        }
        // 记忆恢复radio单选框状态
        radioStorage = localStorage.getItem("radioTagStatus🌼🍄🌼")!=null? localStorage.getItem("radioTagStatus🌼🍄🌼"): "ceaseFire";
        var radioNode = document.getElementById(radioStorage);
        radioNode.setAttribute("checked","checked");
    }

    // * 弱提示 toast
    function popupToast(text,time) {
        let model = document.getElementById('toast-popup');
        if(model!=undefined){//去除已有循环
            clearTimeout(popLoopTime);
            // model.remove();
        }else{
            let editText = text + "<br><br>("+time+"s后自动关闭)";
            var creatediv = document.createElement('div'); // 创建div
            creatediv.className = 'model_toast'; // 添加class
            creatediv.setAttribute('id','toast-popup'); // 添加ID
            var contentHtml = '<div class="popup-toast" id="toast-content">'+editText+'</div>'
            creatediv.innerHTML = contentHtml;
            document.body.appendChild(creatediv); // 将创建的div 加入 body            
        }
        time==undefined?3:time;//默认3s
        var loopRefresh = function(){
            let modelObj = document.getElementById('toast-popup');//又一个坑,填平了
            if(time==0){
                modelObj.style.display = 'none';
                return;
            }else{
                let editText = text + "<br><br>("+time+"s后自动关闭)";
                var content = document.getElementById('toast-content');
                content.innerHTML = editText;
                modelObj.style.display = 'block';
                time--;
                popLoopTime = setTimeout(loopRefresh,1000);
            }
        }
        loopRefresh();
    }

    // localStorage清空垃圾数据
    function storageOperate(){
        var storage = window.localStorage;
        storage.removeItem("game_recode_listdata_h5p_room");
        for(let i = 0; i< storage.length; i++ ){//取出跳转数据
            if(storage.key(i).indexOf("FIRE_POWER_ACT_") != -1 || storage.key(i).indexOf("RankCoverage_vesion_") != -1
               || (storage.key(i).indexOf("carAssigned🚦🚍🚦") != -1 && storage.key(i).indexOf("carAssigned🚦🚍🚦"+(new Date()).toLocaleDateString()) == -1 ) //清除历史车队签到状态
               || (storage.key(i).indexOf("carNumber🚖⛽🚖") != -1 && storage.key(i).indexOf("carNumber🚖⛽🚖"+(new Date()).toLocaleDateString()) == -1 ) //清除历史车队数量
               || (storage.key(i).indexOf("giftNumber💖🎁💖") != -1 && storage.key(i).indexOf("giftNumber💖🎁💖"+(new Date()).toLocaleDateString()) == -1 )){ //清除历史礼物数量
                // || (storage.key(i).indexOf("📱🌐📱") != -1 && storage.key(i).indexOf((new Date()).toLocaleDateString() + "📱🌐📱[" + uname + "]") == -1 )||storage.key(i).indexOf("🐛🌵🐤") != -1){//清除历史跳转次数
                storage.removeItem(storage.key(i));
            }
        }
    }

    //禁言判断(true是被禁言,false为没有禁言)
    function banSpeak(){
        var banObj = document.getElementsByClassName("MuteStatus is-mute")[0];
        if(banObj!=undefined && banObj.innerHTML.indexOf("禁言")!=-1){
            return true;
        }else{
            return false;
        }
    }

    // 参与条件,是否要求为-粉丝团成员  true为粉丝,false为非粉
    function joinCondition(){//参与条件:粉丝团成员。送6鱼翅的办卡就可参与啦
        var joinFlag = false;//参与条件:粉丝团成员。你已经满足参与条件
        var joinObj = document.querySelector(".FirePowerChatModal-joinCondition");
        if(joinObj != undefined){
            joinObj = joinObj.innerText;
            if(joinObj.indexOf("粉丝团成员。送6鱼翅的办卡就可参与") != -1){
                joinFlag = true;
                console.info("只有粉丝团才能参与!");
            }
        }
        return joinFlag;
    }

    // 主播热度筛选
    function hotFilter() {
        let hotFlag = true;
        let hotValue = document.getElementsByClassName("Title-anchorText")[0];//主播热度
        if (hotValue != undefined) {
            tmGap = 10000;
            if (hotValue.innerText <= 1000) {
                tmGap = tmGap + 5000;
            } else if(hotValue.innerText > 1000 && hotValue.innerText <= 10000 ){
                tmGap = tmGap + 2000;
            } else if(hotValue.innerText > 10000 && hotValue.innerText <= 100000){
                tmGap = tmGap ;
            } else if(hotValue.innerText > 100000 && hotValue.innerText <= 300000){
                tmGap = tmGap - 2000;
            } else if(hotValue.innerText > 300000 && hotValue.innerText <= 500000){
                tmGap = tmGap - 4000;
                console.info("热度高中奖难,请跳转!");
                hotFlag = false;
            } else {
                tmGap = tmGap - 6000;
                console.info("热度高中奖难,请跳转!");
                hotFlag = false;
            }
        }else{
            console.error("未获取到热度值,请刷新页面重试!");// location.reload(true);
        }
        return hotFlag;
    }

    // 判断奖品是否是鱼丸或红包奖励
    function awardJudge() {
        var awardDet = document.querySelector(".FirePowerChatModal-detail");//红包
        var awardStr = document.querySelector(".FirePowerChatModal-award");
        function awardConditionFilter(prizeObj){
            var awardFlag = false;
            if (prizeObj != undefined) {
                prizeObj = prizeObj.innerText;
                if(prizeObj.indexOf("鱼丸") != -1) {
                    if(prizeObj.indexOf("1个") == -1 && prizeObj.indexOf("2个") == -1 && prizeObj.indexOf("1条") == -1 && prizeObj.indexOf("2条") == -1 &&
                       (prizeObj.substring(prizeObj.indexOf("鱼丸")-3, prizeObj.indexOf("鱼丸")) >=100 || prizeObj.substring(prizeObj.indexOf("鱼丸")-4, prizeObj.indexOf("鱼丸")) >=100) ){
                        awardFlag = true;
                    }else{
                        console.info("鱼丸奖励不达标-->内");
                    }
                }else if (prizeObj.indexOf("红包") != -1 || prizeObj.indexOf("现金") != -1) {
                    if(prizeObj.indexOf("0.01元") == -1 && prizeObj.indexOf("0.1元") == -1 && prizeObj.indexOf("0.5元") == -1 ){
                        awardFlag = true;
                    }else{
                        console.info("红包奖励不达标-->内");
                    }
                }else{
                    console.info("非实质性奖励-->中");
                }
            }else{
                // console.info( prizeObj == document.querySelector(".FirePowerChatModal-award") ? "无奖品锚点-->外":"无详情锚点-->外");
            }
            return awardFlag;
        }
        return awardConditionFilter(awardStr) || awardConditionFilter(awardDet) ;
    }

    // 调整画质, 1.最高画质; 其他.最低画质
    function adjustClarity(code){
        var videoClarity = document.querySelector(".panelFill-d95ee8");
        if(videoClarity != undefined && videoClarity != null){
            code===1 ? videoClarity.previousSibling.firstElementChild.click() : videoClarity.previousSibling.lastElementChild.click();
        }else{
            console.info("没有画质📺选项!");
        }
    }

    // 记忆滚屏弹幕开关
    function screenBarrageMemory(){
        var closeBarrageObj = document.getElementsByClassName("showdanmu-42b0ac")[0];
        var closeBarrageViceObj = document.getElementsByClassName("hidedanmu-5d54e2")[0];
        if(closeBarrageObj !=undefined ){
            var scrollStatus = localStorage.getItem("scrollBarrage➰🍚➰");
            if(scrollStatus == "close"){
                closeBarrageObj.click();
            }
            closeBarrageObj.addEventListener("mouseup",getScrollStatus);
            closeBarrageViceObj.addEventListener("mouseup",getScrollStatus);
        }else{
            checkDelayCallback(4);//延迟等待元素标签加载
        }
    }

    // 监听用户更改滚屏弹幕状态
    function getScrollStatus(){
        var scrollBarrageObj = document.getElementsByClassName("showdanmu-42b0ac removed-9d4c42")[0];//滚屏弹幕关闭状态
        scrollBarrageObj == undefined ? localStorage.setItem("scrollBarrage➰🍚➰","close") : localStorage.setItem("scrollBarrage➰🍚➰","open");

    }

    // 记忆自动播放开关
    function autoPlayMemory(){
        var playObj = document.getElementsByClassName("play-8dbf03")[0];
        var pauseObj = document.getElementsByClassName("pause-c594e8")[0];
        if(pauseObj!=undefined){
            var autoPlayStatus = localStorage.getItem("autoPlayStatus📀📺📀");
            if(autoPlayStatus == "close"){
                pauseObj.click();
            }
            playObj.addEventListener("mouseup",getAutoPlayStatus);
            pauseObj.addEventListener("mouseup",getAutoPlayStatus);
        }else{
            checkDelayCallback(3);//延迟等待元素标签加载
        }
    }

    // 监听用户更改自动播放状态
    function getAutoPlayStatus(){
        var autoPlayObj = document.getElementsByClassName("pause-c594e8 removed-9d4c42")[0];//播放器暂停状态
        autoPlayObj == undefined ? localStorage.setItem("autoPlayStatus📀📺📀","close") : localStorage.setItem("autoPlayStatus📀📺📀","open");
    }

    //获取不同用户的标识,初次访问会延迟获取uname,不考虑uname变更
    function getUserInfo(){
        uid = document.querySelector(".UserInfo-avatar");
        uid = uid != undefined ? uid.firstElementChild.getAttribute("uid"):"未知";
        if(localStorage.getItem(uid+"🌴🔮🌴")!=null){//如果缓存有uid和uname,则不请求网络
            uname = localStorage.getItem(uid+"🌴🔮🌴");
        }else{
            var ajax = new XMLHttpRequest();
            ajax.timeout = 2000;
            ajax.responseType ="document";
            ajax.open('get', 'https://www.douyu.com/member/cp',true);//采用异步
            ajax.send();
            ajax.onreadystatechange = function() {
                if (ajax.readyState == 4 && ajax.status == 200) {
                    var htmlDoc = ajax.responseXML;
                    uname = htmlDoc.querySelector(".uname_con").innerText.trim()
                    localStorage.setItem(uid+"🌴🔮🌴", uname);
                }
            }
        }
    }

    // 增加代码统计,测试下云端弹幕接口访问频次,如果频次高的话,后期增加本地缓存
    function jsonAnalytics(code){
        //statistics'1278115154';barrage
        let siteId = '1278051049';//page  
        siteId = code == 1?'1278051049':'1278115154';
        var statJs = document.createElement('script');
        statJs.type = 'text/javascript';
        statJs.async = true;
        statJs.charset = 'utf-8';
        statJs.src = 'https://w.cnzz.com/c.php?async=1&id=' + siteId;
        var rootJs = document.getElementsByTagName('script')[0];
        rootJs.parentNode.insertBefore(statJs, rootJs);
    }

    // 获取当前房间的roomId
    function getRoomId(){
        roomId = document.getElementsByClassName("Title-anchorName")[0];
        roomId = roomId!=undefined ? roomId.getAttribute("href").substr(roomId.getAttribute("href").indexOf("room_id=")+8):undefined;
    }

    // 显示当前直播间主播信用,真实人数,和累计开播时间在房间热度图标左侧
    function realPersonNum(){
        var dailyJumpCount = localStorage.getItem((new Date()).toLocaleDateString() + "📱🌐📱[" + uname + "]");
        dailyJumpCount = dailyJumpCount!=null?dailyJumpCount:0;
        var showPosition = document.querySelector(".Title-anchorHot");
        var divTag = document.createElement("div");
        divTag.className = "Title-anchorName";
        divTag.innerHTML = "<dfn id = 'real_person_num' data-info='点击此区域可以更新以下四组数据,图标说明如下: 🌐-今日跳转次数(仅统计用此脚本自动或手动跳转); 💎-主播当前信用值(若<=4则不能送礼物,满值12); 🎅-当前房间在线人数(未开播房间则为0未统计); ⏰-房间本次开播时间累计/min(未开播则为“-”);'> 🌐- 💎- 🎅- ⏰- </dfn>";//显示当前跳转次数,主播信用,真实人数,和累计开播时间
        showPosition.parentNode.insertBefore(divTag, showPosition);
        realPersonNumRefresh();//更新数据;
        divTag.addEventListener("click",realPersonNumRefresh);
    }

    //刷新真实人数
    function realPersonNumRefresh(){
        var dailyJumpCount = localStorage.getItem((new Date()).toLocaleDateString() + "📱🌐📱[" + uname + "]");
        dailyJumpCount = dailyJumpCount!=null?dailyJumpCount:0;
        fetch('https://www.douyu.com/swf_api/h5room/'+ roomId).then(res => {
            return res.json();
        }).then(json => {
            var personNum = json.data.online;
            var curCredit = json.data.cur_credit;
            var liveTime = json.data.show_time;
            var liveStatus = json.data.show_status;//是否开播,全局变量
            // var barrageDelay = jsonData.data.room_dm_delay;
            var onlineTime = 0;
            if(liveStatus == "1"){//开播
                onlineTime = ((Math.round((new Date()).getTime()/1000) - parseInt(liveTime))/60).toFixed(1);// 显示房间已经直播的分钟数,保留一位小数,来显示秒
            }else{
                onlineTime = "-"
            }
            var peopleObj = document.getElementById("real_person_num");
            if(peopleObj!=undefined){
                peopleObj.innerHTML = "🌐"+dailyJumpCount +"&nbsp;💎"+curCredit +"&nbsp;🎅"+ personNum + "&nbsp;⏰" + onlineTime + "&nbsp;";
            }
        }).catch(err => {
            console.error('请求错误', err);
        })
    }

    //不绑定手机号发弹幕(前提是必须是其他账号登陆状态,非登陆状态不行)
    function releasePhoneLimit(){
        var btnGray = document.getElementsByClassName("ChatSend-button is-gray")[0];
        var chatLogin = document.getElementsByClassName("MuteStatus is-noLogin")[0];
        btnGray!=undefined ? btnGray.className = "ChatSend-button ":false;
        chatLogin!=undefined ? chatLogin.remove():false;
    }

    // 参与条件关注,则自动点击关注   #关注  #取关
    function followRoom() {
        var subObj = document.querySelector(".Title-followBtn");
        var followCheck = document.getElementsByClassName("Title-followBtnBox is-followed")[0];//已关注检测
        if (subObj != undefined && followCheck==undefined) {
            subObj.click();
            console.info("已经关注💓主播");
            setTimeout(autoAssign, 4000);//延时签到为了和初始化签到错开
        }
    }

    // 房间自动点击签到
    function autoAssign(){
        let anchorLevel = (document.getElementsByClassName("AnchorLevel")[0]).getAttribute("class").substring(24);
        if(anchorLevel>=30 ){//排除已签到
            let assignObj = document.getElementsByClassName("RoomLevelDetail-icon")[0];//签到按钮是否加载检测
            let followCheck = document.getElementsByClassName("Title-followBtnBox is-followed")[0];//是否已关注检测
            if(assignObj!=undefined && followCheck!=undefined){
                let unassign = document.getElementsByClassName("RoomLevelDetail-icon RoomLevelDetail-icon--zn")[0];
                if(unassign!=undefined){
                    unassign.click();//点击签到按钮
                    popupToast("《房间自动签到》<br>房间自动点击签到📝成功!", 3);
                    console.info("房间签到📝完毕!");
                }
            }else{
                checkDelayCallback(5);
            }
        }
    }

    //房间签到排行显示
    // function assignRank(){
    //     var anchorLevel = (document.getElementsByClassName("AnchorLevel")[0]).getAttribute("class").substring(24);
    //     var showPlace = document.querySelector(".Title-anchorHot");
    //     // 获取当前房间签到的排名
    //     if(anchorLevel>=30){//不排除已签到,因为还需要手动刷新
    //         var refreshTag = document.createElement("dfn");
    //         refreshTag.setAttribute("id","assign_Rank");
    //         refreshTag.setAttribute("class","Title-anchorName");
    //         refreshTag.setAttribute("data-info","📝-表示当前房间已签到人数,点击可以刷新,方便大家来抢签到手气王,如果主播等级<Lv30无房间签到,则无此图标,可统计前100的排名,需要注意当处于⛔停火状态才能手动签到,其他状态仍是自动签到;");
    //         refreshTag.innerHTML= "📝-";
    //         showPlace.parentNode.insertBefore(refreshTag, showPlace);
    //         assignRefresh();
    //         refreshTag.addEventListener("click",assignRefresh);
    //     }
    // }
    //刷新签到排行
    // function assignRefresh(){
    //     fetch('https://www.douyu.com/japi/roomuserlevel/apinc/getSignInRankInfoList?rid='+roomId).then(res => {
    //         return res.json();
    //     }).then(json => {
    //         var jsonData = json.data;
    //         var assignId = document.getElementById("assign_Rank");
    //         assignId.innerHTML = jsonData.length <100? "📝"+jsonData.length:"📝100+";
    //         // console.info("📝房间签到人数:"+jsonData.length);
    //     }).catch(err => {
    //         console.error('请求错误', err);
    //     })
    // }

    //通过API签到接口发送签到请求,请求要附带cookie,用户要为登陆状态,此处为核心代码
    function fastAssign(){
        var ajax = new XMLHttpRequest();
        ajax.responseType ="json";
        ajax.open('post', 'https://www.douyu.com/japi/roomuserlevel/apinc/checkIn',true);//采用异步
        ajax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded;charset-UTF-8");
        if(getCookie()==""){
            setCookie("acf_ccn",guid());
        }
        var paramStr = "rid="+ roomId + "&ctn=" + getCookie('acf_ccn');
        ajax.send(paramStr);
        ajax.onreadystatechange = function() {
            if (ajax.readyState == 4 && ajax.status == 200) {
                var json = ajax.response;
                if(json.data.rank !=-1){
                    let tomorrowTime = (new Date()).setHours(0, 0, 0, 0) + 3600*24*1000 ;//设为明天天0点0分0秒0毫秒。
                    popupToast("《极速房间签到》<br>API接口自动签到📝成功,签到排名:【"+ json.data.rank+"】<br>签到时间:"+new Date().toLocaleTimeString(), 10);
                    console.info("API接口自动签到📝成功,签到排名:["+ json.data.rank+"],签到时间:"+new Date().toLocaleTimeString());
                    localStorage.setItem("USER_ROOM_LEVEL_SIGN_"+ roomId, '{"c":'+ (new Date()).getTime() +',"e":'+ tomorrowTime +',"v":\"1\","r":1}');
                    console.info("本地已缓存房间签到,刷新页面后显示!")
                }
            }
        }
    }

    //轮询主播是否开播监测
    function pollingAnchorStatus(){
        var anchorLevel = (document.getElementsByClassName("AnchorLevel")[0]).getAttribute("class").substring(24);
        fetch('https://www.douyu.com/wgapi/livenc/liveweb/follow/special',{
            method: 'GET',
            mode: 'cors', //请求模式为跨域
            cache: 'no-store', //不缓存
            credentials: 'include', // 同源则加入凭据头,cookies
        }).then(res => {
            return res.text();
        }).then(json => {
            var followList = JSON.parse(json);
            followList = followList.data;
            var roomFlag = false;
            for(let i=0; i<followList.length; i++){
                if(followList[i].room_id == roomId){
                    roomFlag=true;
                    break;
                }
            }
            if(roomFlag){//判断主播是否在特别关注列表
                if(anchorLevel>=30 ){
                    if(getCookie('acf_ccn')!=null&&getCookie('acf_ccn')!=""){
                        statusInterval = setInterval(getAnchorStatus,sendGap);//每隔sendGap向服务器发送一次自动签到请求
                        popupToast("《极速房间签到》<br>极速签到功能已正常开启<br>正在疯狂输出中...", 3);
                    }else{
                        setCookie("acf_ccn",guid());//为过期的cookie赋值;
                    }
                }else{
                    console.info("主播等级<Lv.30,无房间可签到!");
                }
            }else{
                popupToast("《极速房间签到》<br>当前房间未添加到“特别关注”<br>请添加后并重新切换到⚡才能开启!", 3);
                console.info("当前房间未添加到“特别关注”,添加后重新切到⚡才能开启极速签到!");
            }
        }).catch(err => {
            console.error('请求错误', err);
        })
    }

    // 获取特别关注列表主播开播状态,延迟ms
    function getAnchorStatus(){
        fetch('https://www.douyu.com/wgapi/livenc/liveweb/follow/special',{
            method: 'GET',
            mode: 'cors', //请求模式为跨域
            cache: 'no-store', //不缓存
            credentials: 'include' // 同源则加入凭据头,cookies
        }).then(res => {
            return res.text();
        }).then(json => {
            var followList = JSON.parse(json);
            followList = followList.data;
            // console.info(followList);
            for(let i=0; i<followList.length; i++){
                if(followList[i].room_id == roomId){
                    if(followList[i].show_status=="1"){
                        fastAssign();//快速签到
                        console.info("已开播")
                        clearInterval(statusInterval);
                    }else{
                        console.info("未开播["+followList[i].show_status+"]检测中");
                    }
                    break;
                }
            }
        }).catch(err => {
            console.error('请求错误', err);
        })
    }
    //生成随机uuid
    function guid() {
        return 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'.replace(/[x]/g, function (c) {
            var r = Math.random() * 16 | 0,
                v = c == 'x' ? r : (r & 0x3 | 0x8);
            return v.toString(16);
        });
    }
    //签到acf_ccn过期时间为2h
    function setCookie(name,value)
    {
        var exp = new Date();
        exp.setTime(exp.getTime() + 2*60*60*1000);
        document.cookie = name + "="+ escape (value) + ";expires=" + exp.toGMTString();
    }

    //获取极速签到接口权限
    function getCookie(cookieName) {
        var acf_ccn = "";
        var strCookie = document.cookie;
        var arrCookie = strCookie.split("; ");
        for(var i = 0; i < arrCookie.length; i++){
            var arr = arrCookie[i].split("=");
            if(cookieName == arr[0]){
                acf_ccn = arr[1];
            }
        }
        return acf_ccn;
    }

    // 斗鱼平台礼物展示  ===============================todo:需要用到postMessage页面传值gift_json
    function giftView(){
        var giftNumberObj = localStorage.getItem("giftNumber💖🎁💖"+(new Date()).toLocaleDateString());
        var showPlace = document.querySelector(".Title-anchorHot");
        var giftTag = document.createElement("dfn");
        giftTag.setAttribute("class","Title-anchorName");
        giftTag.setAttribute("data-info","🎁-斗鱼礼物种类总量,点击可查看礼物图片,数据统计每天自动更新一次,图片则与服务端实时同步;");
        if(giftNumberObj!=null ){
            giftTag.innerHTML="<a href='https://popzoo.github.io/pop/giftshow.html' target='_blank' style='text-decoration:none;'>🎁"+giftNumberObj+"</a>";
        }else{//获取所有礼物图片url,并展示
            fetch('https://webconf.douyucdn.cn/resource/common/gift/flash/gift_effect.json').then(res => {
                return res.text();
            }).then(result => {
                result = result.substring(17, result.length-2);
                var jsonData = JSON.parse(result);
                jsonData=jsonData.data.flashConfig;
                var jsonLength=0;
                for(let key in jsonData){
                    jsonLength++;
                }
                localStorage.setItem("giftNumber💖🎁💖"+(new Date()).toLocaleDateString(),jsonLength);
                giftTag.innerHTML="<a href='https://popzoo.github.io/pop/giftshow.html' target='_blank' style='text-decoration:none;'>🎁"+jsonLength+"</a>";
            }).catch(err => {
                console.error('请求错误', err);
            })
        }
        showPlace.parentNode.insertBefore(giftTag, showPlace);
    }

    // 车队签到入口,每天自动打开跳转一次签到
    function motorcadeEntrance(){//
        let carNumberObj = localStorage.getItem("carNumber🚖⛽🚖"+(new Date()).toLocaleDateString());
        var showPlace = document.querySelector(".Title-anchorHot");
        var carTag = document.createElement("dfn");
        carTag.setAttribute("class","Title-anchorName");
        carTag.setAttribute("data-info","🚖-斗鱼车队总数,点击可进入车队界面,每天首次启动脚本后自动跳转页面执行签到和领取车队加油卡,免费车队请点击🎁图标进入‘车队展’中查看;");
        if(carNumberObj!=null){
            carTag.innerHTML="<a href='https://msg.douyu.com/motorcade/' target='_blank' style='text-decoration:none;'>🚖"+ carNumberObj +"</a>";
        }else{//获取斗鱼车队总数并展示
            fetch('https://webconf.douyucdn.cn/resource/common/fleet/fleet_config.json').then(res => {
                return res.text();
            }).then(result => {
                result = result.substring(17, result.length-2);
                var jsonData = JSON.parse(result);
                jsonData = jsonData.data.list;
                var count = 0;
                for(let key in jsonData){
                    if(jsonData[key].cid!=undefined && jsonData[key].cid!=""){
                        count++;
                    }
                }
                localStorage.getItem("carNumber🚖⛽🚖"+(new Date()).toLocaleDateString(), count);
                carTag.innerHTML="<a href='https://msg.douyu.com/motorcade/' target='_blank' style='text-decoration:none;'>🚖"+ count +"</a>";
            }).catch(err => {
                console.error('请求错误', err);
            })
        }
        showPlace.parentNode.insertBefore(carTag, showPlace);
        // 检测车队是否重复签到
        let carStatus = localStorage.getItem("carAssigned🚦🚍🚦"+(new Date()).toLocaleDateString());
        if(carStatus=="true"){//如果今日车队没有签到,则执行一次
            console.info("车队已签到,不再重复执行!");
        }else{
            localStorage.setItem("carAssigned🚦🚍🚦"+(new Date()).toLocaleDateString(),"true");
            window.open("https://msg.douyu.com/motorcade/", "_blank");
        }
    }

    // 重新点击radio的跳转处理
    function openFireFilter(){
        let fireCheck = document.querySelector(".FirePowerChatModal-Notice");//检测火力全开
        if( fireCheck != undefined && hotFilter() && awardJudge() && !joinCondition() && !banSpeak() ){ //判断奖品、热度数量和是否要求粉丝团,hotFilter需要初始化
            console.info("符合开火🔥条件,初始化准备开火");
            followRoom();//自动关注主播
            firePowerController();//立即执行火力全开
        }else{//有火力不符合筛选
            popupToast("《火力全开搜寻》<br>当前房间不符合开火🔥条件<br>3秒后自动跳转新🏠!", 3);
            fireSeekJump = setTimeout(randomFireRequest,3000);//重新获取有火力全开的房间号
        }
    }

    // 二合一开关函数,开启后,失效其他radio
    function switchChange(){
        clearTimeout(fireSeekJump);//避免快速切换二合一开关会跳转的问题,这也是个坑
        let switchStatus = localStorage.getItem("switchStatus🏮🎎🏮");
        if(switchStatus =="on"){//关闭开关
            document.getElementById("label_open_fire").removeAttribute("style");
            document.getElementById("label_thunder").removeAttribute("style");
            localStorage.setItem("switchStatus🏮🎎🏮","off");
            if(radioStorage == "openFire"){
                openFireFilter();
            }
        }else{//打开开关
            document.getElementById("label_open_fire").style.display="none"; 
            document.getElementById("label_thunder").style.display="none";            
            localStorage.setItem("switchStatus🏮🎎🏮","on");
            if(radioStorage=="bombFire"){
                bombFireFilter();
            }else if(radioStorage=="openFire"){
                openFireFilter();
            }
        }
        console.info("二合一开关状态:"+localStorage.getItem("switchStatus🏮🎎🏮"));
    }

    // 重新点击radio的跳转处理
    function bombFireFilter(){
        let fireCheck = document.querySelector(".FirePowerChatModal-Notice");//检测火力全开
        if( fireCheck != undefined && hotFilter() && !joinCondition() && awardJudge() && !banSpeak() ){ //判断奖品、热度数量,粉丝牌检测
            followRoom();//自动关注主播
            firePowerController();
        }else{
            if(localStorage.getItem("switchStatus🏮🎎🏮")=="on"){
                popupToast("《二合一功能开启》<br>当前房间不符合开火🔥条件<br>3秒后自动跳转!", 3);
                fireSeekJump = setTimeout(randomFireRequest,3000);//搜索火力全开
            }else{
                firePowerController();
            }
        }
    }

    // 监听radio的onchange事件
    function radioChange(msg){
        if(msg == "ceaseFire"){//停火
            radioStorage = "ceaseFire";
            clearInterval(statusInterval);
            clearTimeout(firePowerTime);
            clearTimeout(fireSeekJump);
            console.info("⛔停止开火");
            localStorage.setItem("radioTagStatus🌼🍄🌼",msg);
        }else if(msg =="openFire"){//开火
            radioStorage = "openFire";
            clearInterval(statusInterval);
            clearTimeout(firePowerTime);
            clearTimeout(fireSeekJump);
            console.info("🔥火力全开");
            localStorage.setItem("radioTagStatus🌼🍄🌼",msg);
            openFireFilter();
        }else if(msg =="bombFire"){//轰炸
            radioStorage = "bombFire";
            clearInterval(statusInterval);
            clearTimeout(firePowerTime);
            clearTimeout(fireSeekJump);
            console.info("💥弹幕轰炸");
            localStorage.setItem("radioTagStatus🌼🍄🌼",msg);
            bombFireFilter();
        }else if(msg =="thunderAssign"){//开火
            radioStorage = "thunderAssign";
            clearInterval(statusInterval);
            clearTimeout(firePowerTime);
            clearTimeout(fireSeekJump);
            console.info("⚡极速签到");
            localStorage.setItem("radioTagStatus🌼🍄🌼",msg);
            pollingAnchorStatus();
        }
    }

    //===============================================================
    //++++++++主函数入口区域,根据元素加载进度自动开始初始化程序++++++
    //===============================================================
    function programInitCheck(){ //自动检测浏览器出现火力全开后则执行脚本
        var chatCheck = document.querySelector(".ChatSend");//检测聊天区加载
        if(chatCheck==undefined){
            checkDelayCallback(0);
        }else{//执行初始化组件
            sbts = (new Date()).getTime();//记录初始化时间戳
            msgTxt = document.querySelector(".ChatSend-txt");
            msgBtn = document.querySelector(".ChatSend-button");
            msgBtn.addEventListener("mouseup",clickBtnEvent);//绑定鼠标事件
            document.onkeydown = function(e){e.keyCode==13?clickBtnEvent():false}//绑定键盘事件
            creatBtnTag();//先添加手动按钮
            jsonAnalytics(1);//云弹幕计数
            screenBarrageMemory();//记忆滚屏弹幕状态
            autoPlayMemory();//记忆自动播放状态
            // adjustClarity(0);//调整画质,其他.画质最低,1.画质最高
            getUserInfo();//依据用户id分类,前置执行,包含统计云弹幕
            getRoomId();//获取房间真实ID
            motorcadeEntrance();//车队签到入口
            giftView();//礼物种类加载
            realPersonNum();//房间真实人数模块加载,获取主播开播状态,先于房间签到执行
            // setTimeout(assignRank, 1000);//房间签到排行,需要roomId
            setTimeout(releasePhoneLimit,3000);//去除手机绑定的限制
            cloudBarrage();//云弹幕加载
            autoAssign();//房间自动签到
            sbts = (new Date()).getTime();//记录初始化时间戳
            checkDelayCallback(1);//延迟回调,进入弹幕初始化-barrageInitCheck
        }
    }

    //===============================================================
    //+++++++++++++++++++++++回调延迟函数检测++++++++++++++++++++++++
    //===============================================================
    function checkDelayCallback(code){
        if(code===0){
            setTimeout(programInitCheck,1000);
        }else if(code===1){
            setTimeout(barrageInitCheck,1000);
        }else if(code===2){//暂无火力等待
            if(((new Date()).getTime() - sbts) > 1000*12){//超过12s没检测到火力则自动执行下列操作
                popupToast("《火力全开搜寻》<br>本房间不符合开火🔥条件<br>3秒后自动跳转!", 3);
                console.info("不符合开火🔥条件,3秒后自动跳转新🏠");
                fireSeekJump = setTimeout(randomFireRequest,3000);
            }else{
                setTimeout(barrageInitCheck,1000);
            }
        }else if(code===3){
            if(((new Date()).getTime() - sbts)/1000 < 15){
                setTimeout(autoPlayMemory,1000);//恢复记忆自动播放,延迟15s等待元素标签加载
            }
        }else if(code===4){
            if(((new Date()).getTime() - sbts)/1000 < 15){
                setTimeout(screenBarrageMemory,1000);//恢复记忆滚屏弹幕,延迟等待15s元素标签加载
            }
        }else if(code===5){
            if(((new Date()).getTime() - sbts)/1000 < 15){
                setTimeout(autoAssign,2000);//自动签到,延迟等待15s元素标签加载
            }
        }
    }

    //===============================================================
    //+++++++++++++++++++++++弹幕组件初始化检测++++++++++++++++++++++
    //===============================================================
    function barrageInitCheck(){
        if(radioStorage == "openFire"){
            let fireCheck = document.querySelector(".FirePowerChatModal-Notice");//检测火力全开
            if(fireCheck!=undefined){//有火力全开
                openFireFilter();
            }else{
                checkDelayCallback(2);
            }
        }else if(radioStorage == "bombFire"){
            let fireCheck = document.querySelector(".FirePowerChatModal-Notice");//检测火力全开
            if(fireCheck!=undefined){//有火力全开
                bombFireFilter();
            }else{
                if(localStorage.getItem("switchStatus🏮🎎🏮")=="on"){
                    checkDelayCallback(2);//这里一定需要等待检测火力全开,这个坑,填了
                }else{
                    firePowerController();
                }
            }
        }else if(radioStorage == "thunderAssign"){//自动刷新后则继续监测
            pollingAnchorStatus();
        }else{//ceaseFire or undefined
            console.info("初始化火力停止⛔");
            storageOperate();//自动清理localStorage
        }
    }
    setTimeout(programInitCheck, 4000); //4S后按页面加载进度自动设定执行脚本初始化加载时间
}

function yubaScript(){
    var page = 1;//默认分页从第一页开始
    var asignStr = "";
    // 鱼吧签到 POST
    function yubaAssign(groupId,groupName){
        let postData = "group_id="+groupId;//+"&cur_exp=15";//这里忽略了当前经验参数的传送
        fetch('https://yuba.douyu.com/ybapi/topic/sign', {//?timestamp=0.122968905822739
            // fetch('https://msg.douyu.com/v3/motorcade/getSetting?timestamp='+Math.random(), {
            method: 'POST',
            mode: 'cors',
            credentials: 'omit',
            headers: {
                // "x-csrf-token":"GFFVRWBzyh9vrY0GsDJLGjCiNNtLet3Bd9",//这个值是cookie里的acf_yb_t
                'Content-Type': 'application/x-www-form-urlencoded'
            },
            body: postData
        }).then(json => {
            if(json.data.level!=undefined){
                console.info("【"+groupName+"】的鱼吧已签到,鱼吧等级为Lv."+json.data.level);
                asignStr += "【"+ groupName +"】、";
            }
        }).catch(err => {
            console.error('请求错误', err);
        })
    }

    // 最多获取鱼吧收藏列表前30的鱼吧,默认不加条数限制则每页返回6条数据
    function yubaFollowList(){
        fetch('https://yuba.douyu.com/wbapi/web/group/myFollow?limit=30&page='+ page,{//timestamp=0.33173683329112125
            method: 'GET',
            mode: 'no-cors', //请求模式为跨域
            cache: 'default', //no-cache
            credentials: 'include', // 同源则加入凭据头,omit,include
        }).then(result => {
            let jsonData=result.data.list;
            if(jsonData!=undefined && jsonData!=""){//防止递归死循环跳出的保险设置
                // let overCount = 5;
                let overCount = jsonData.length;
                let i = 0;
                var loopit = function(){
                    if(i==overCount){
                        // console.info("本页签到完毕!");
                        yubaFollowList(++page);
                        return;
                    }else{
                        yubaAssign(jsonData[i].group_id,jsonData[i].group_name);
                        i++;
                        setTimeout(loopit,parseInt(Math.random()*50)+150);
                    }
                }
                loopit();
            }else{
                localStorage.setItem("yubaAssigned💧☔💧"+(new Date()).toLocaleDateString(),"true");
                asignStr = asignStr.substr(0,asignStr.length-1);
                storageClear();//清除历史缓存
                alert(asignStr+"的鱼吧(鱼吧收藏列表),今日签到完毕!");
            }
        }).catch(err => {
            console.error('请求错误', err);
        })
    }

    // localStorage清空垃圾数据
    function storageClear(){
        var storage = window.localStorage;
        storage.removeItem("game_recode_listdata_h5p_room");
        for(let i = 0; i< storage.length; i++ ){//取出跳转数据
            if( storage.key(i).indexOf("yubaAssigned💧☔💧") != -1 && storage.key(i).indexOf("yubaAssigned💧☔💧"+(new Date()).toLocaleDateString()) == -1 ){//清除历史鱼吧签到状态
                storage.removeItem(storage.key(i));
            }
        }
    }

    let yubaStatus = localStorage.getItem("yubaAssigned💧☔💧"+(new Date()).toLocaleDateString());
    if(yubaStatus=="true"){//如果今日鱼吧没有签到,则执行一些
        console.info("鱼吧已签到,不再重复执行!");
    }else{
        setTimeout(yubaFollowList,2000);
    }
}

function motorcadeScript(){
    //获取自己车队的mid,从页面元素抓取
    var sbts = new Date().getTime();
    function getMotorcadeMid(){
        var tagObj = document.getElementsByClassName("linkWrap--3Bin_")[1];//第二个
        if(tagObj!=undefined){
            sbts = new Date().getTime();
            let mid = tagObj.getAttribute("href");
            mid = mid.substring(12);
            if(mid!="undefined"){
                console.info("我的车队号:"+mid);
                motorcadeCheck(mid);
            }else{
                waitElementLoad(2);//等待数据渲染
            }
        }else{
            waitElementLoad(1);
        }
    }

    function waitElementLoad(code){
        if(code===1){
            if(new Date().getTime()-sbts<1000*15){
                setTimeout(getMotorcadeMid,1000);
            }else{
                // console.info("加载超时,请重试");
                return;
            }
        }else if(code===2){
            if(new Date().getTime()-sbts<1000*6){
                setTimeout(getMotorcadeMid,1000);
            }else{
                console.info("没有加入车队或无法获取车队号!");;
            }
        }
    }

    //获取签到接口权限
    function getCookie(cookieName) {
        var csrfToken = "";
        var strCookie = document.cookie;
        var arrCookie = strCookie.split("; ");
        for(var i = 0; i < arrCookie.length; i++){
            var arr = arrCookie[i].split("=");
            if(cookieName == arr[0]){
                csrfToken = arr[1];
            }
        }
        if(csrfToken == ""){
            csrfToken = Math.random().toString(36).substr(2);
            document.cookie = "post-csrfToken="+ escape(csrfToken)+";path=/";
        }
        return csrfToken;
    }

    //斗鱼我的车队是否签到查看
    function motorcadeCheck(mid){//escape(mid) +'&timestamp='+Math.random().toFixed(16)
        fetch('https://msg.douyu.com/v3/motorcade/signs/weekly?mid='+ mid, {
            method: 'GET',
            mode: 'cors',
            credentials: 'include',
            headers: {
                'dy-device-id':'-',
                "dy-client": "web",
                "dy-csrf-token":getCookie("post-csrfToken"),
            }
        }).then(result => {
            if(result.data.is_sign=="0"){
                console.info("本周已签到次数:"+result.data.total);
                motorcadeAssign(mid,1+parseInt(result.data.total));
                // }else if(result.data.is_sign=="1"){
                //     console.info("车队已签到,不再重复执行!");
            }else{
                console.info(result.message);
            }
        }).catch(err => {
            console.error('请求错误', err);
        })
    }

    //斗鱼我的车队签到
    function motorcadeAssign(mid,total){//encodeURIComponent(mid)
        let postData = "to_mid="+ mid +"&expression="+total;
        fetch('https://msg.douyu.com/v3/msign/add?timestamp='+Math.random().toFixed(17), {
            method: 'POST',
            mode: 'cors',
            credentials: 'include',
            headers: {
                'dy-device-id':'-',
                "dy-client": "web",
                "dy-csrf-token":getCookie("post-csrfToken"),
                'Content-Type': 'application/x-www-form-urlencoded'
            },
            body: postData
        }).then(result => {
            if(result.status_code=="200"){
                // console.info("车队签到完毕!");
                alert("车队自动签到完毕!");
            }else{
                console.info(result.message);
            }
        }).catch(err => {
            console.error('请求错误', err);
        })
    }
    setTimeout(getMotorcadeMid,3000);
}
//===============================================================
//+++++++++++++++++++++根据域名控制加载脚本++++++++++++++++++++++
//===============================================================
(function(){
    if(window.location.host=="yuba.douyu.com"){//当前域名为鱼吧的时候
        yubaScript();
    }else if(window.location.host=="msg.douyu.com"){//当前域名为车队时候
        motorcadeScript();
    }else{//当前域名为www.douyu.com时候
        roomScript();
    }
})();