Greasy Fork

Greasy Fork is available in English.

斗鱼自动发送弹幕、火力全开、领取鱼丸、清爽模式、调节画质

抄袭弹幕、循环弹幕(DIY 彰显个性)、关键词回复弹幕(设定关键词和回复,自动聊天)、抽奖弹幕(限定发送次数;自动检测新一轮抽奖;检测是否拥有粉丝牌)、动态弹幕发送时间(想检测我?门都没有) ________ 清爽模式,部分隐藏、宽屏模式、网页全屏(大屏优化,看播更爽!) ________ 自动签到、自动领取观看鱼丸、自动最低(高)画质 ________ 设置界面可以设定以上功能默认开启(彻底解放你的双手)

当前为 2019-10-06 提交的版本,查看 最新版本

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name			斗鱼自动发送弹幕、火力全开、领取鱼丸、清爽模式、调节画质
// @namespace		http://tampermonkey.net/
// @version			1.1.5
// @icon			http://www.douyutv.com/favicon.ico
// @description		抄袭弹幕、循环弹幕(DIY 彰显个性)、关键词回复弹幕(设定关键词和回复,自动聊天)、抽奖弹幕(限定发送次数;自动检测新一轮抽奖;检测是否拥有粉丝牌)、动态弹幕发送时间(想检测我?门都没有) ________ 清爽模式,部分隐藏、宽屏模式、网页全屏(大屏优化,看播更爽!) ________ 自动签到、自动领取观看鱼丸、自动最低(高)画质 ________ 设置界面可以设定以上功能默认开启(彻底解放你的双手)
// @author			H2P
// @compatible		chrome
// @require			https://cdn.bootcss.com/jquery/3.3.1/jquery.min.js
// @require			https://cdnjs.cloudflare.com/ajax/libs/vue/2.6.10/vue.min.js
// @match			*://*.douyu.com/0*
// @match			*://*.douyu.com/1*
// @match			*://*.douyu.com/2*
// @match			*://*.douyu.com/3*
// @match			*://*.douyu.com/4*
// @match			*://*.douyu.com/5*
// @match			*://*.douyu.com/6*
// @match			*://*.douyu.com/7*
// @match			*://*.douyu.com/8*
// @match			*://*.douyu.com/9*
// @match			*://*.douyu.com/topic/*
// @note			2019.03.18-V0.2.0 循环弹幕可以设置多条,随机发送;新增弹幕倒计时;界面美化一下?抽奖弹幕新增一种查询类型
// @note			2019.03.18-V0.3.0 界面修改;界面可隐藏;可以设置是否发送默认弹幕
// @note			2019.03.18-V0.3.1 小 BUG 修复
// @note			2019.03.19-V0.4.0 引入 JQuery 改写,还没改完;更新了弹幕抽奖元素获取(因为斗鱼改了);增加设置抽奖弹幕次数;发送弹幕时可以修改循环弹幕
// @note			2019.03.23-V0.4.1 完善了一下代码;完善了界面;修改了字体
// @note			2019.03.23-V0.5.0 添加了斗鱼清爽模式:隐藏部分、隐藏全部、删除元素
// @note			2019.03.23-V0.5.1 修缮清爽模式;添加自动领取观看鱼丸(不是鱼秀宝箱)
// @note			2019.03.24-V0.5.2 修缮自动领取观看鱼丸;修缮隐藏全部元素的返回按钮
// @note			2019.03.24-V0.5.3 修改介绍。。。
// @note			2019.03.26-V0.5.4 修缮自动领取观看鱼丸,如果无法领取则清除循环
// @note			2019.03.28-V0.5.5 解决 jQuery $ 冲突;清爽模式处理粉丝节
// @note			2019.03.31-V0.6.0 添加“功能自动化”设置面板
// @note			2019.03.31-V0.6.1 修改介绍
// @note			2019.04.02-V0.6.2 代码重写
// @note			2019.04.04-V0.6.3 添加抄袭弹幕;完善设置信息存储
// @note			2019.05.25-V0.6.4 完善清爽模式退出
// @note			2019.06.11-V0.6.5 更新斗鱼领取宝箱
// @note			2019.07.04-V0.7.0 聚合脚本图标;删去抽奖弹幕
// @note			2019.07.05-V0.7.1 添加抽奖弹幕;发送时间设定改为间隔时间,单位改为毫秒;修改循环弹幕会自动保存
// @note			2019.07.06-V0.7.2 小小修缮
// @note			2019.07.06-V0.7.3 发送弹幕时间在间隔内随机
// @note			2019.07.06-V0.7.4 更新介绍(我觉得我输在介绍不够长、不够骚)
// @note			2019.07.06-V0.7.5 自动领鱼丸更新;抽奖弹幕更新(感谢 beacoolguy 的反馈)
// @note			2019.07.06-V0.7.6 自动点击抽奖弹幕“一键参与”(仅限发弹幕抽奖);清爽模式屏蔽贵族弹幕
// @note			2019.07.09-V0.7.7 抽奖弹幕“一键参与”(仅限条件:发弹幕和关注主播);样式修改;新功能(关键词自动回复展望)
// @note			2019.07.09-V0.7.8 清爽模式针对“topic”直播间和大屏幕优化
// @note			2019.07.11-V0.7.9 添加关键词回复(目前只能设置关键词和回复,无法使用)
// @note			2019.07.14-V0.8.0 关键词回复可以使用啦!!!(最多五条关键词)
// @note			2019.07.22-V0.8.1 修复关键词回复
// @note			2019.08.02-V0.8.2 弹幕抽奖增加拥有粉丝牌的抽奖条件
// @note			2019.08.12-V0.8.3 弹幕抽奖完善拥有粉丝牌的抽奖条件;部分清爽模式修改
// @note			2019.08.13-V0.8.4 清爽模式部分隐藏修缮
// @note			2019.08.16-V0.8.5 清爽模式修缮
// @note			2019.08.17-V0.8.6 清爽模式部分隐藏修缮
// @note			2019.08.26-V0.8.7 清爽模式添加宽屏模式;ESC 快捷退出清爽模式
// @note			2019.08.26-V0.8.8 清爽模式位置更换
// @note			2019.09.05-V0.8.9 修缮关键词回复对于有粉丝牌无效的问题
// @note			2019.09.08-V0.9.0 关键词回复可以添加和删除;新一轮抽奖开启后清除上一轮抽奖弹幕内容
// @note			2019.09.10-V0.9.1 解决初始化失败的问题
// @note			2019.09.10-V0.9.2 解决关键词回复自己弹幕的问题
// @note			2019.09.10-V0.9.3 解决初始化失败的问题
// @note			2019.09.12-V0.9.4 在主播公司旁显示直播时长
// @note			2019.09.14-V1.0.0 Vue 重写自动发送弹幕和自动化配置界面;取消默认弹幕,抄袭弹幕增加抄袭间隔;取消显示直播时长
// @note			2019.09.14-V1.0.1 更新介绍
// @note			2019.09.14-V1.0.2 修复弹幕抽奖不工作;添加删除无关元素
// @note			2019.09.14-V1.0.3 修复弹幕抽奖不工作;Vue 重写清爽模式
// @note			2019.09.14-V1.0.4 修复关键词回复无法自动配置的问题;添加保留词 {showT} 用于替换主播直播时长
// @note			2019.09.15-V1.0.5 将主播直播时长保存在本地;修复 {showT} 替换失败问题
// @note			2019.09.15-V1.0.6 修复抽奖弹幕赠送 666 的问题
// @note			2019.09.16-V1.0.7 设置抄袭弹幕和循环弹幕优先级相同
// @note			2019.09.16-V1.0.8 解决 topic 房间 id 获取失败的问题
// @note			2019.09.24-V1.0.9 清除分区冠军赛;自动最低(高)画质
// @note			2019.09.24-V1.1.0 自动参与火力全开;解决自动签到、领取鱼丸一直检测的问题
// @note			2019.09.25-V1.1.1 更新自动领取鱼丸;解决处于发送等待期尝试发送弹幕的问题;领取鱼丸发送弹幕任务无法完成
// @note			2019.09.25-V1.1.2 添加在电脑面前检测
// @note			2019.09.28-V1.1.3 修复删除元素后宽屏导致礼物栏显示空白的问题
// @note			2019.10.06-V1.1.4 清爽模式增加单独处理弹幕栏;清爽信息栏还未实现
// @note			2019.10.07-V1.1.5 优化清爽模式;全屏模式、网页全屏已失效
// @grant			none
// ==/UserScript==

(()=>{
	'use strict';

	// 解决 jQuery $ 符号冲突
	var $h2p_j = jQuery.noConflict();

	var BOOL_ok_sendBar = false;		// 自动弹幕模块是否装载完毕
	var BOOL_ok_clear = false;			// 自动清理模块是否装载完毕
	var BOOL_ok_config = false;			// 斗鱼设置模块是否装载完毕
	var BOOL_ok_localS = false;			// localStorage 是否读取完毕

	var BOOL_vue_sendBar= false;		// 自动弹幕模块 Vue 是否构建完毕
	var BOOL_vue_clear	= false;		// 自动清爽模式 Vue 是否构建完毕
	var BOOL_vue_config = false;		// 自动配置模块 Vue 是否构建完毕

	const MAX_barList = 120;			// 弹幕列表最多弹幕条数
	const MAX_DYWidth = 1200;

	var userInfo = {
		nickName	: '',				// 昵称
		isAnchorFan : false,			// 是否拥有主播的粉丝牌
	};

	var roomInfo = {
		id		: '',
		showT	: 0,
		kind1	: '',
		kind2	: '',
	}

	// 创建元素样式
	var h2p_DYScript_style_sendBar = document.createElement('style');
	h2p_DYScript_style_sendBar.type = 'text/css';
	h2p_DYScript_style_sendBar.innerHTML = (()=>{/*
		.h2p-div-panel {
			position 		: absolute;
			bottom 			: 1px;
			min-width 		: 335px;
			max-width 		: 335px;
			border 			: none;
			border-radius	: 2px;
			margin 			: 0 0 0 -1px;
			box-shadow		: #c7c7c7 0 -10px 10px 0;
			display			: none;
			z-index 		: 999;
		}
		.h2p-div-inlinepanel {
			min-width 		: 315px;
			max-width 		: 315px;
			padding 		: 10px;
			border-width	: 0 0 1px 0;
			border-radius	: 2px;
			font-family		: WeibeiSC-Bold, STKaiti;
			font-size		: 16px;
			background		: #f5f5f5;
		}
		.h2p-div-inlinetab {
			min-width 		: 335px;
			max-width 		: 335px;
			border-top		: 1px solid #DCDCDC;
			border-radius	: 2px;
			font-family		: WeibeiSC-Bold, STKaiti;
			font-size		: 16px;
			background		: #f5f5f5;
		}
		.h2p-div-layer {
			position	: relative;
			width		: 100%;
			height		: 24px;
		}
		.h2p-div-layer-half {
			position	: absolute;
			width		: 50%;
			height		: 24px;
		}
		.h2p-checkbox-left {
			position	: absolute;
			top			: 0;
			bottom		: 0;
			left		: 0;
			margin		: auto;
		}
		.h2p-input-normal {
			position		: relative;
			height			: 22px;
			padding			: 0px 5px;
			border			: 1px solid #708090;
			border-radius	: 5px;
			font-size		: 13px;
		}
		.h2p-input-disable {
			background		: #DCDCDC;
			cursor			: default;
		}
		.h2p-input-able {
			background		: white;
			cursor			: text;
		}
		.h2p-textarea-loopBarrage {
			width			: 287px;
			height			: 90px;
			padding			: 3px;
			border			: 1px solid #708090;
			border-radius	: 5px;
			margin			: 0 0 0 20px;
			font-size		: 13px;
			resize			: none;
		}
		.h2p-btn-sendBar {
			width			: 100%;
			height			: 100%;
			padding			: 4px 0;
			border			: none;
			border-radius	: 5px;
			margin			: 0;
			font-size		: 13px;
			background		: #00ddbb;
			cursor			: pointer;
		}
		.h2p-div-sign {
			width			: 18px;
			height			: 18px;
			display			: inline-block;
			vertical-align 	: middle;
		}
		.h2p-div-tab {
			width			: 33.3%;
			max-height		: 29px;
			padding			: 2px 0;
			text-align		: center;
			display			: inline-block;
		}
		.h2p-div-tab:hover {
			cursor			: pointer;
			background		: #DDDDDD;
		}
		.h2p-span-sign {
			font-size		: 18px;
			cursor			: pointer;
		}
		.h2p-label-checkbox-left { margin : 0 0 0 20px }
		.h2p-color-font-green { color : #228B22 }
		.h2p-hover-pointer:hover {
			cursor			: pointer;
			background		: #DDDDDD;
		}
	*/}).toString().split('/*')[1].split('*/')[0];
	document.head.appendChild(h2p_DYScript_style_sendBar);


	// 整个面板 ===============================================================
	var div_DYScript = $h2p_j('<div id="div-DYScript" class="h2p-div-panel"></div>');

	// 面板底部功能键
	var div_DYScriptTab = ()=>{
		var greyAllTabs = () => {
			$h2p_j('div#div-sendBar').hide();
			$h2p_j('div#div-tab-sendBarrage').css('background', '#f5f5f5');
			$h2p_j('div#div-DYLight').hide();
			$h2p_j('div#div-tab-DYLight').css('background', '#f5f5f5');
			$h2p_j('div#div-config').hide();
			$h2p_j('div#div-tab-setting').css('background', '#f5f5f5');
		}

		let div_DYScriptTab = $h2p_j('<div id="div-DYScriptTab" class="h2p-div-inlinetab"></div>');

		// 发弹幕
		let div_tab_barrage = $h2p_j('<div id="div-tab-sendBarrage" class="h2p-div-tab" style="background: #DDDDDD;" title="发弹幕">📢</div>');
		$h2p_j(div_tab_barrage).click(()=>{
			greyAllTabs();
			$h2p_j('div#div-sendBar').show();
			$h2p_j('div#div-tab-sendBarrage').css('background', '#DDDDDD');
		});

		// 清爽模式
		let div_tab_light = $h2p_j('<div id="div-tab-DYLight" class="h2p-div-tab" style="width: 33.4%" title="清爽模式">✡️</div>');
		$h2p_j(div_tab_light).click(()=>{
			greyAllTabs();
			$h2p_j('div#div-DYLight').show();
			$h2p_j('div#div-tab-DYLight').css('background', '#DDDDDD');
		});

		// 自动化设置
		let div_tab_setting = $h2p_j('<div id="div-tab-setting" class="h2p-div-tab" title="自动化设置">⏲️</div>');
		$h2p_j(div_tab_setting).click(()=>{
			greyAllTabs();
			$h2p_j('div#div-config').show();
			$h2p_j('div#div-tab-setting').css('background', '#DDDDDD');
		});

		$h2p_j(div_DYScriptTab).append( div_tab_barrage );
		$h2p_j(div_DYScriptTab).append( div_tab_light );
		$h2p_j(div_DYScriptTab).append( div_tab_setting );

		return div_DYScriptTab;
	};








// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //
// 发弹幕
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //








	// 初始化自动发弹幕界面  ===============================================================
	(()=>{
		var str_div_bar = (()=>{/*
			<div id="div-sendBar" class="h2p-div-inlinepanel">
				<!-- 发送弹幕的速度 And 倒计时 -->
				<div class="h2p-div-layer">
					<label>间隔:</label>
					<input id="input-sendBar-speedMin" class="h2p-input-normal" :class="[ isSending ? 'h2p-input-disable' : 'h2p-input-able' ]" style="width: 44px; margin-left: -10px" placeholder=">2000" v-model="speedMin" @keyup="speedCheck" @blur="speedMinStore" :disabled="isSending" />
					<i>~</i>
					<input id="input-sendBar-speedMax" class="h2p-input-normal" :class="[ isSending ? 'h2p-input-disable' : 'h2p-input-able' ]" style="width: 44px;" placeholder=">2000" v-model="speedMax" @keyup="speedCheck" @blur="speedMaxStore" :disabled="isSending" />
					<label>毫秒</label>
					<input id="input-CD" class="h2p-input-normal h2p-input-disable" style="position: absolute; right: 0; width: 32px;" v-model="CD_sendBar" disabled/>
				</div>

				<hr style="margin: 3px; border: 1px solid transparent;">

				<!-- 是否发送抄袭弹幕 -->
				<div class="h2p-div-layer" style="height: 22px;">
					<div class="h2p-div-layer-half">
						<input id="input-bar-isCopy" class="h2p-checkbox-left" type="checkbox" :checked="isCopy" @click="change_isCopy" />
						<label class="h2p-label-checkbox-left">发送抄袭弹幕</label>
					</div>
					<div class="h2p-div-layer-half" style="left: 50%">
						<label class="h2p-color-font-green">抄袭间隔:</label>
						<input id="input-copyBar-interval" class="h2p-input-normal" style="position: absolute; width: 65px;" placeholder="默认 0 条" @keyup="copyINVLInput" @blur="copyINVLBlur" v-model="INVL_copy" />
					</div>
				</div>

				<hr style="margin: 3px; border: 1px solid transparent;">

				<!-- 是否发送循环弹幕 -->
				<div class="h2p-div-layer" style="height: 98px;">
					<input id="input-bar-isLoop" class="h2p-checkbox-left" type="checkbox" :checked="isLoop" @click="change_isLoop" />
					<textarea id="input-loopBar-content" class="h2p-textarea-loopBarrage" :class="[ isSending ? 'h2p-input-disable' : 'h2p-input-able' ]" placeholder="循环弹幕" @change="loopBarInput" @blur="loopBarStore" :disabled="isSending"></textarea>
				</div>

				<hr style="margin: 3px; border: 1px solid transparent;">

				<!-- 是否使用关键词自动回复 -->
				<div class="h2p-div-layer">
					<div class="h2p-div-layer-half">
						<input id="input-bar-isKeyReply" class="h2p-checkbox-left" type="checkbox" :checked="isKeyReply" @click="change_isKeyReply" />
						<label class="h2p-label-checkbox-left">关键词回复</label>
						<button class="h2p-hover-pointer" style="width: 26px; border-radius: 50%" title="添加关键词" @click="keyReplyAdd">+</button>
					</div>
					<div class="h2p-div-layer-half" style="left: 50%">
						<select id="select-keyReply" style="width: 100%; height: 24px;" @click="keyReplySelect" @change="keyReplySelect">
							<option v-for="keyReply in keyReplys" :value="keyReply.value">{{ keyReply.key }}</option>
						</select>
					</div>
				</div>
				<hr style="margin: 3px; border: 1px solid transparent;">
				<div class="h2p-div-layer">
					<div class="h2p-div-layer-half">
						<button class="h2p-checkbox-left h2p-hover-pointer" style="border-radius: 50%" title="删除关键词"  @click="keyReplyDel">-</button>
						<input id="input-keyReply-key" class="h2p-input-normal h2p-label-checkbox-left" style="width: 70%;" placeholder="关键词" v-model="key" @keyup="keyReplyStore">
					</div>
					<div class="h2p-div-layer-half" style="left: 50%">
						<input id="input-keyReply-reply" class="h2p-input-normal" style="width: 90%; padding: 0 4.2%;" placeholder="自动回复弹幕" v-model="reply" @keyup="keyReplyStore" />
					</div>
				</div>

				<hr style="margin: 3px; border: 1px solid transparent;">

				<!-- 是否参加弹幕抽奖 -->
				<div class="h2p-div-layer">
					<div class="h2p-div-layer-half">
						<input id="input-bar-isLuckDraw" class="h2p-checkbox-left" type="checkbox" :checked="isLuckDraw" @click="change_isLuckDraw" />
						<label class="h2p-label-checkbox-left">发送抽奖弹幕</label>
					</div>
					<div class="h2p-div-layer-half" style="left: 50%">
						<label class="h2p-color-font-green">抽奖发送:</label>
						<input class="h2p-input-normal h2p-input-disable" style="width: 22px; margin-left: -15px;" v-model="CNT_luckDraw" disabled />
						<i style="margin: 0 -5px">/</i>
						<input class="h2p-input-normal" :class="[ isSending ? 'h2p-input-disable' : 'h2p-input-able' ]" style="width: 22px;" placeholder="默认 2 次" v-model="CNT_luckDrawTotal" @keyup="luckDrawCountInput" @blur="luckDrawCountBlur" :disabled="isSending" />
					</div>
				</div>

				<hr style="margin: 3px; border: 1px solid transparent;">

				<!-- 开启弹幕发送按钮 -->
				<div class="h2p-div-layer">
					<button id="btn-sendBar" class="h2p-btn-sendBar" :style="{ background : clr_btnSend }" @mouseover="btn_sendBar_mouseOver" @mouseout="btn_sendBar_mouseOut" @click="openAutoSendBar">{{ Con_btnSend }}</button>
				</div>
			</div>
		*/}).toString().split('/*')[1].split('*/')[0].replace(/[\n]/g, '');
		var div_bar = $h2p_j(str_div_bar);

		$h2p_j(div_DYScript).append(div_bar);

		// 检查弹幕面板挂载点(斗鱼弹幕显示区域)是否加载完成
		var check_mountPoint_barPanel = setInterval( ()=>{
			if ( $h2p_j('div.layout-Player-asideMainTop').length > 0 && $h2p_j('div.BarrageSuperLink').length > 0 ) {
				window.clearInterval( check_mountPoint_barPanel );
				check_mountPoint_barPanel = undefined;
				setTimeout( ()=>{ $h2p_j('div.layout-Player-asideMainTop').append( div_DYScript ); }, 2000);
			}
		}, 1000);

		// 检查弹幕图标挂载点(斗鱼弹幕输入框)是否加载完成
		var check_mountPoint_barIcon = setInterval( ()=>{
			if ( $h2p_j('div#div-sendBar').length > 0 ) {
				window.clearInterval( check_mountPoint_barIcon );
				check_mountPoint_barIcon = undefined;
				BOOL_ok_sendBar = true;
			}
		}, 1000);
	})();

	let INVL_barSend= undefined;	// 自动发弹幕
	let INVL_barCD	= undefined;	// 弹幕倒计时

	let speed = 0;					// 弹幕发送间隔时间
	const speedDef	= 6000;			// 弹幕发送默认间隔时间
	let loopBarConTemp = '';		// 循环弹幕临时缓存
	let luckDrawBar	= '';			// 抽奖弹幕内容
	let CD_luckDraw	= 0;			// 弹幕抽奖活动倒计时
	const CNT_luckDrawDef = 2;		// 抽奖弹幕默认发送次数
	let INDEX_keyReply = 0;			// 关键词回复弹幕列表已经检测的位置

	window.vue_sendBar = undefined;
	// 发送弹幕组件构建 Vue
	var INVL_createVue_sendBar = setInterval( ()=>{
		if ( BOOL_ok_sendBar ) {
			vue_sendBar = new Vue({
				el		: '#div-sendBar',
				data	: {
					speedMin	: 2000,
					speedMax	: 3000,
					isCopy		: false,
					isLoop		: false,
					isKeyReply	: false,
					isLuckDraw	: false,
					keyReplys	: [],
					key			: '',
					reply		: '',
					INVL_copy	: 0,				// 抄袭间隔弹幕数目
					CD_sendBar	: 0,				// 弹幕倒计时	
					CNT_luckDraw: 0,				// 抽奖弹幕实际发送次数
					CNT_luckDrawTotal: 2,			// 抽奖弹幕总共发送次数
					Con_btnSend	: '发送',
					clr_btnSend	: '#00ddbb',
					isSending	: false,
				},
				computed: {},
				methods	: {
					isStrNone			: (str)=>{ return str == undefined || str.length == 0; },
					change_isCopy		: ()=>{ vue_sendBar.isCopy		= !vue_sendBar.isCopy; },
					change_isLoop		: ()=>{ vue_sendBar.isLoop		= !vue_sendBar.isLoop; },
					change_isKeyReply	: ()=>{ vue_sendBar.isKeyReply	= !vue_sendBar.isKeyReply; },
					change_isLuckDraw	: ()=>{ vue_sendBar.isLuckDraw	= !vue_sendBar.isLuckDraw; },
					btn_sendBar_mouseOver	: ()=>{ vue_sendBar.clr_btnSend = '#00d1b2'; },
					btn_sendBar_mouseOut	: ()=>{ vue_sendBar.clr_btnSend = '#00ddbb'; },
					lenCheck	: (value, len)=>{
						value = value.replace(/[^\d]/g,'');
						if ( value.length > len ) { value = value.substr(0, len); }
						return value;
					},
					numCheck	: (value, len)=>{
						value = value.replace(/[^\d]/g,'');
						while( value.length > 0 && value[0] == '0' ) { value = value.substr(1, value.length); }
						if ( value.length > len ) { value = value.substr(0, len); }
						return value;
					},
					copyINVLInput	: ()=>{
						vue_sendBar.INVL_copy = vue_sendBar.lenCheck(vue_sendBar.INVL_copy, 3);
					},
					copyINVLBlur	: ()=>{
						vue_sendBar.INVL_copy = vue_sendBar.lenCheck(vue_sendBar.INVL_copy, 3);
						if ( vue_sendBar.INVL_copy.length == 0 ) { vue_sendBar.INVL_copy = 0; }
						h2p_DYScript_config.INVL_copy = parseInt(vue_sendBar.INVL_copy);
						localStorage.setItem('h2p-DYScript-config', JSON.stringify(h2p_DYScript_config) );
					},
					speedCheck		: (event)=>{
						let value = $h2p_j(event.target).val();
						value = vue_sendBar.lenCheck(value, 6);
						$h2p_j(event.target).val(value)
					},
					speedMinStore	: ()=>{
						vue_sendBar.speedMin = vue_sendBar.numCheck(vue_sendBar.speedMin, 6);
						vue_sendBar.speedMin = parseInt(vue_sendBar.speedMin) ? parseInt(vue_sendBar.speedMin) : speedDef;
						h2p_DYScript_config.speedMin = vue_sendBar.speedMin;
						localStorage.setItem('h2p-DYScript-config', JSON.stringify(h2p_DYScript_config) );
					},
					speedMaxStore	: (event)=>{
						vue_sendBar.speedMax = vue_sendBar.numCheck(vue_sendBar.speedMax, 6);
						vue_sendBar.speedMax = parseInt(vue_sendBar.speedMax) ? parseInt(vue_sendBar.speedMax) : vue_sendBar.speedMin + 1500;
						h2p_DYScript_config.speedMax = vue_sendBar.speedMax > vue_sendBar.speedMin ? vue_sendBar.speedMax : vue_sendBar.speedMin + 1500;
						localStorage.setItem('h2p-DYScript-config', JSON.stringify(h2p_DYScript_config) );
					},
					loopBarInput	: (event)=>{
						loopBarConTemp = $h2p_j(event.target).val();
						localStorage.setItem('h2p-DYScript-config', JSON.stringify(h2p_DYScript_config) );
					},
					loopBarStore	: ()=>{
						if ( loopBarConTemp.length > 0 ) {
							h2p_DYScript_config.loopBarCon = loopBarConTemp;
							loopBarConTemp = '';
							localStorage.setItem('h2p-DYScript-config', JSON.stringify(h2p_DYScript_config) );
						}
					},
					keyReplyAdd		: ()=>{
						vue_sendBar.key = '&待定&';
						vue_sendBar.reply = '';
						let keyReply = { 'key' :  vue_sendBar.key, 'value' : vue_sendBar.reply };
						vue_sendBar.keyReplys.push(keyReply);
						h2p_DYScript_config.keyReplys.push(keyReply);
						localStorage.setItem('h2p-DYScript-config', JSON.stringify(h2p_DYScript_config) );
						setTimeout(()=>{
							$h2p_j('#select-keyReply > option:last').attr('selected', 'true');
						}, 100);
					},
					keyReplyDel		: ()=>{
						let index = document.getElementById('select-keyReply').selectedIndex;
						Vue.delete(vue_sendBar.keyReplys, index);
						h2p_DYScript_config.keyReplys.splice(index, 1);
						localStorage.setItem('h2p-DYScript-config', JSON.stringify(h2p_DYScript_config) );
	
						setTimeout(()=>{
							// 关键词和回复全部删除了
							if ( $h2p_j('select#select-keyReply option:selected').length > 0 ) {
								let option = $h2p_j('select#select-keyReply option:selected');
								vue_sendBar.key = option.text();
								vue_sendBar.reply = option.val();
							} else {
								vue_sendBar.key = '';
								vue_sendBar.reply = '';
							}
						}, 100);
					},
					// select 元素选择 option
					keyReplySelect	: ()=>{
						let option = $h2p_j('select#select-keyReply option:selected');
						vue_sendBar.key = option.text();
						vue_sendBar.reply = option.val();
					},
					keyReplyStore	: ()=>{
						let index = document.getElementById('select-keyReply').selectedIndex;
						let keyReply = { 'key' : vue_sendBar.key, 'value' : vue_sendBar.reply };
						Vue.set(vue_sendBar.keyReplys, index, keyReply);
						h2p_DYScript_config.keyReplys.splice(index, 1, keyReply);
						localStorage.setItem('h2p-DYScript-config', JSON.stringify(h2p_DYScript_config) );
					},
					// 抽奖弹幕输入框输入检测
					luckDrawCountInput	: (event)=>{
						let value = $h2p_j(event.target).val();
						value = vue_sendBar.lenCheck(value, 2);
						vue_sendBar.CNT_luckDrawTotal = parseInt(value) ? parseInt(value) : '';
					},
					// 抽奖弹幕输入框失去焦点
					luckDrawCountBlur	: (event)=>{
						let value = $h2p_j(event.target).val();
						value = vue_sendBar.numCheck(value, 2);
						vue_sendBar.CNT_luckDrawTotal = parseInt(value) ? parseInt(value) : CNT_luckDrawDef;
					},
					sendBar	: ()=>{
						let barrage = '';

						// 优先抽奖弹幕
						if ( vue_sendBar.isLuckDraw && $h2p_j('div.UPlayerLotteryEnter-deadsec').length > 0 ){
							// 计算目前倒计时
							let CD_luckDraw_now = $h2p_j('div.UPlayerLotteryEnter-deadsec').text().split(':').reduce( (valPrev, val)=>{return parseInt(valPrev) * 60 + parseInt(val);} );

							// 判断是否是新一轮抽奖
							if ( CD_luckDraw_now > CD_luckDraw ) {
								// 清除上一轮抽奖内容
								luckDrawBar = undefined;
								// 新一轮抽奖弹幕
								vue_sendBar.CNT_luckDraw = 0;
								// 显示抽奖内容
								$h2p_j('div.UPlayerLotteryEnter.is-active').click();

								try{
									// 获取抽奖弹幕条件
									let barREQM = $h2p_j('div.ULotteryStart-rule > span:eq(0)').text().split(':')[1];
									const REQMs = ['发弹幕', '发弹幕+关注主播'];
									// 不是赠送、礼物、福袋、数字、盛典
									let regex = /[\u8d60\u9001\u793c\u7269\u798f\u888b\d\u76db\u5178]+/g;
									if ( barREQM.search(regex) < 0 && ( REQMs.indexOf(barREQM) > -1 || (userInfo.isAnchorFan && barREQM.indexOf('成为粉丝') > -1) ) ) {
										// 一键参与
										$h2p_j('div.ULotteryStart-joinBtn').click();										
										// 获取抽奖弹幕内容
										luckDrawBar = $h2p_j('span.ULotteryStart-danmuDesc.UserLottery-ellipse.is-coping').text();
										luckDrawBar = luckDrawBar.split(':')[1] ? luckDrawBar.split(':')[1] : luckDrawBar.split(':')[0];
									}
								} catch (err) { console.log('不是弹幕抽奖'); }
								finally { $h2p_j('span.LotteryContainer-close').click(); }
							}

							barrage = vue_sendBar.CNT_luckDraw < vue_sendBar.CNT_luckDrawTotal ? luckDrawBar : '';
							if ( barrage != undefined && barrage.length > 0 ) { vue_sendBar.CNT_luckDraw++; }
							CD_luckDraw = CD_luckDraw_now;
						}

						// 关键词弹幕回复
						if ( vue_sendBar.isStrNone(barrage) && vue_sendBar.isKeyReply ) {
							let bars = $h2p_j('ul#js-barrage-list > li');
							if ( bars.length > MAX_barList ) {
								let surplusNum = bars.length - MAX_barList;
								$h2p_j('#js-barrage-list > li:lt(' + surplusNum + ')').remove();
								INDEX_keyReply = INDEX_keyReply > surplusNum ? INDEX_keyReply - surplusNum : 0;
								bars = $h2p_j('ul#js-barrage-list > li');
							}
							for ( let i = INDEX_keyReply; i < bars.length; i++ ) {
								INDEX_keyReply++;
								let ele = bars[i];
								let bar_check = $h2p_j(ele).find('span[class^="Barrage-content"]').text().replace(/\s/g, '');
								let nickName = $h2p_j(ele).find('span[class^="Barrage-nickName"]').attr('title');
								let keys = [];
								let keyReplys = vue_sendBar.keyReplys;
								for ( let i = 0; i < keyReplys.length; i++ ){
									let keyReply = keyReplys[i];
									if ( keyReply.key != undefined && keyReply.key.length > 0 && keyReply.key != '&待定&' ) { keys.push(keyReply.key); }
								}
								let index = ((bar_check) => {
									for ( let j = 0; j < keys.length; j++ ) {
										// 不回复自己的弹幕
										if ( bar_check.indexOf(keys[j]) > -1 && nickName != userInfo.nickName ) { return j; }
									}
									return -1;
								})(bar_check);
								barrage = index > -1 && index < keyReplys.length ? keyReplys[index].value : '';
								if ( !vue_sendBar.isStrNone(barrage) ) break;
							}
						}

						// 循环发送抄袭弹幕
						if ( vue_sendBar.isStrNone(barrage) && ( ( vue_sendBar.isCopy && !vue_sendBar.isLoop ) || ( vue_sendBar.isCopy && vue_sendBar.isLoop && Math.random() > 0.5 ) ) ) {
							if ( $h2p_j('span.Barrage-content').length > 0 ) {
								let barListLen = $h2p_j('span.Barrage-content').length;
								let index = barListLen - 1;
								if ( vue_sendBar.INVL_copy < barListLen - 1 ) { index -= vue_sendBar.INVL_copy; }
								else { index -= Math.floor( Math.random * (barListLen - 1) ); }
								barrage = $h2p_j('span.Barrage-content:eq(' + index + ')').text().replace(/\s/g, '');
								barrage = barrage.length > 0 ? barrage : $h2p_j('span.Barrage-content:eq(' + (index + 1) + ')').text().replace(/\s/g, '');
							}
						}

						// 循环发送自定义弹幕 
						if ( vue_sendBar.isStrNone(barrage) && vue_sendBar.isLoop ) {
							let barrageLoop = $h2p_j('textarea#input-loopBar-content').val().split('\n');
							let index = Math.round( Math.random()*barrageLoop.length );
							barrage = barrageLoop[index] ? barrageLoop[index] : barrageLoop[0];
						}

						if ( !vue_sendBar.isStrNone(barrage) ) {
							if ( barrage.indexOf('{showT}') > -1 ) {
								if ( roomInfo.showT > 0 ) {
									let showT = parseInt( (new Date().getTime() / 1000) - roomInfo.showT) / 3600.0;
									let h = parseInt( showT );
									let m = parseInt( ( showT - h ) * 60 );
									let str_showT = h + '小时' + m + '分钟';
									barrage = barrage.replace('{showT}', str_showT);
								} else { barrage = barrage.replace('{showT}', '0'); }
							}
							$h2p_j('textarea.ChatSend-txt').val(barrage);
							if ( $h2p_j('div.ChatSend-button.is-gray').length == 0 ) { $h2p_j('div.ChatSend-button').click(); }
						}

						if ( INVL_barCD == undefined ) { setINVL_barCD(); }

						// 重新计算发送速度
						speed = Math.floor( Math.random() * (vue_sendBar.speedMax - vue_sendBar.speedMin) + vue_sendBar.speedMin );
						// 重新显示倒计时
						vue_sendBar.CD_sendBar = parseInt( speed / 100 ) / 10.0;
						window.clearInterval(INVL_barSend);
						INVL_barSend = setInterval(vue_sendBar.sendBar, speed);
					},
					// 开启发送弹幕
					setINVL_autoSendBar	: ()=>{
						speed = Math.floor( Math.random() * (vue_sendBar.speedMax - vue_sendBar.speedMin) + vue_sendBar.speedMin );
						vue_sendBar.isSending = true;
						vue_sendBar.CNT_luckDraw = 0;

						$h2p_j('#div-tab-sendBarrage').text('🔥');

						INVL_barSend = setInterval(vue_sendBar.sendBar, speed);
					},
					// 停止发送弹幕
					clearINVL_autoSendBar : ()=>{
						window.clearTimeout(INVL_barSend);
						INVL_barSend = undefined;

						vue_sendBar.isSending = false;

						$h2p_j('#div-tab-sendBarrage').text('📢');
					},
					// 开启倒计时
					setINVL_barCD : ()=>{
						if ( vue_sendBar.CD_sendBar <= 0 ) { vue_sendBar.CD_sendBar = parseInt( speed / 100 ) / 10; }
						INVL_barCD = setInterval( ()=>{
							if ( vue_sendBar.CD_sendBar <= 0 ) { vue_sendBar.CD_sendBar = parseInt( speed / 100 ) / 10; }
							vue_sendBar.CD_sendBar = ( vue_sendBar.CD_sendBar * 10 - 1 ) / 10;
						}, 100);
					},
					clearINVL_barCD : ()=>{
						window.clearInterval(INVL_barCD);
						INVL_barCD = undefined;
						vue_sendBar.CD_sendBar = 0;
					},
					// 开始发送弹幕和倒计时
					openAutoSendBar		: ()=>{
						vue_sendBar.clearINVL_barCD();
						if ( INVL_barSend == undefined ) {
							vue_sendBar.setINVL_autoSendBar();
							vue_sendBar.setINVL_barCD();
						}
						else { vue_sendBar.clearINVL_autoSendBar(); }
						vue_sendBar.Con_btnSend = vue_sendBar.isSending ? '停止发送' : '发送';
					},
				}
			});

			BOOL_vue_sendBar = true;
			window.clearInterval(INVL_createVue_sendBar);
			INVL_createVue_sendBar = undefined;
		}
	}, 100 );








// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //
// 清爽模式
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //








	// 创建元素样式
	var h2p_DYScript_style_clear = document.createElement('style');
	h2p_DYScript_style_clear.type = 'text/css';
	h2p_DYScript_style_clear.innerHTML = (()=>{/*
		.h2p-btn-hideAll-back {
			position 		: fixed;
			right			: 0;
			bottom			: 0;
			width			: 55px;
			height			: 55px;
			padding			: 10px;
			border			: none;
			font-size		: 13px;
			background		: transparent;
			cursor			: pointer;
			display			: none;
		}
		.h2p-btn {
			width			: 100%;
			height			: 100%;
			padding			: 4px 0;
			border			: none;
			border-radius	: 5px;
			margin			: 0;
			font-size		: 13px;
			background		: #00ddbb;
			cursor			: pointer;
		}
		.h2p-bg-blue1	{ background : #00ddee }
		.h2p-top-0		{ top : 0!important }
		.h2p-w-96p		{ width : 96%!important }
		.h2p-h-100p 	{ height : 100%!important }
		.h2p-bg-black	{ background : black!important }
		.h2p-padding-15 { padding : 15px!important }
	*/}).toString().split('/*')[1].split('*/')[0];
	document.head.appendChild(h2p_DYScript_style_clear);

	// 初始化自动发弹幕界面  ===============================================================
	(()=>{
		var str_div_light = (()=>{/*
			<div id="div-DYLight" class="h2p-div-inlinepanel" style="display: none">
				<hr style="margin: 1px 6px; border: 1px solid transparent;">

				<div class="h2p-div-layer" style="height: 27px;">
					<div class="h2p-div-layer-half" style="height: 100%">
						<button class="h2p-btn h2p-bg-blue1 h2p-w-96p" @click="clearInfo" v-if="isClearInfo">显示信息栏</button>
						<button class="h2p-btn h2p-w-96p" @click="clearInfo" v-else>清爽信息栏</button>
					</div>
					<div class="h2p-div-layer-half" style="left: 50%; height: 100%">
						<button class="h2p-btn h2p-bg-blue1 h2p-w-96p" style="float: right" @click="clearBar" v-if="isClearBar">显示弹幕栏</button>
						<button class="h2p-btn h2p-w-96p" style="float: right" @click="clearBar" v-else>清爽弹幕栏</button>
					</div>
				</div>
				<hr style="margin: 6px; border: 1px solid transparent;">

				<div class="h2p-div-layer" style="height: 27px;">
					<div class="h2p-div-layer-half" style="height: 100%">
						<button class="h2p-btn h2p-bg-blue1 h2p-w-96p" @click="clearGift" v-if="isClearGift">显示礼物栏</button>
						<button class="h2p-btn h2p-w-96p" @click="clearGift" v-else>清爽礼物栏</button>
					</div>
					
					<div class="h2p-div-layer-half" style="left: 50%; height: 100%">
						<button class="h2p-btn h2p-bg-blue1 h2p-w-96p" style="float: right" @click="clearPlay" v-if="isClearPlay">显示播放器</button>
						<button class="h2p-btn h2p-w-96p" style="float: right" @click="clearPlay" v-else>清爽播放器</button>
					</div>
				</div>

				<hr style="margin: 6px; border: 1px solid transparent;">

				<div class="h2p-div-layer" style="height: 27px;">
					<button class="h2p-btn h2p-bg-blue1" @click="clearCancel" v-if="isClearAll">显示全部</button>
					<button class="h2p-btn" @click="clearAll" v-else>清爽全部</button>
				</div>
				
				<hr style="margin: 6px; border: 1px solid transparent;">

				<button class="h2p-btn" :class="{'h2p-bg-blue1':isHidePS}" @click="hidePS">{{ Con_btn_ps }}</button>

				<hr style="margin: 6px; border: 1px solid transparent;">
				<div class="h2p-div-layer" style="height: 27px;">
					<div class="h2p-div-layer-half" style="height: 100%">
						<button class="h2p-btn h2p-w-96p" :class="{'h2p-bg-blue1':isHideWS}" @click="hideWS">{{ Con_btn_ws }}</button>
					</div>
					<div class="h2p-div-layer-half" style="left: 50%; height: 100%">
						<button class="h2p-btn h2p-w-96p" :class="{'h2p-bg-blue1':isHideFS}" style="float: right" @click="hideFS">{{ Con_btn_fs }}</button>
					</div>
				</div>

				<hr style="margin: 1px 6px; border: 1px solid transparent;">
			</div>
		*/}).toString().split('/*')[1].split('*/')[0].replace(/[\n]/g, '');
		var div_light = $h2p_j(str_div_light);

		$h2p_j(div_DYScript).append(div_light);
		
		var check_mountPoint_lightIcon = setInterval( ()=>{
			if ( $h2p_j('div#div-DYLight').length > 0 ) {
				window.clearInterval( check_mountPoint_lightIcon );
				check_mountPoint_lightIcon = undefined;
				BOOL_ok_clear = true;
			}
		}, 1000);
	})();

	window.vue_light = undefined;
	// 清爽模式组件构建 Vue
	let startPS = 0;
	let startWS = 0;
	let startFS = 0;
	let waitMin = 3;
	let waitSec = 3;
	var INVL_createVue_clear = setInterval( ()=>{
		if ( BOOL_ok_clear ) {
			// 在弹幕栏上添加热度
			if ( $h2p_j('div.AnchorAnnounce > a.Title-anchorHot').length == 0 ) {
				$h2p_j('div.AnchorAnnounce').append( $h2p_j('<a class="Title-anchorHot" style="display:none"><i class="Title-anchorHotIcon"></i></a>') );
				$h2p_j('div.AnchorAnnounce').addClass('h2p-h-100p');
			}

			vue_light = new Vue({
				el		: '#div-DYLight',
				data	: {
					isClearInfo	: false,
					isClearBar	: false,
					isClearGift	: false,
					isClearPlay	: false,
					isClearAll	: false,
					isHidePS	: false,
					isHideWS	: false,
					isHideFS	: false,
					Con_btn_ps	: '部分隐藏',
					Con_btn_ws	: '宽屏模式',
					Con_btn_fs	: '网页全屏',
				},
				methods	: {
					clearPlay	: ()=>{
						vue_light.isClearPlay = !vue_light.isClearPlay;
						let eles = ['div#js-bottom', 'div.guessGameContainer.is-normalRoom', 'div.ActivityList > div.ActivityItem:gt(0)'];
						eles.forEach( ele => { $h2p_j(ele).toggle(); } );
						$h2p_j('div#js-room-activity').toggle();				// 分区冠军赛
					},
					clearBar	: ()=>{
						vue_light.isClearBar = !vue_light.isClearBar;
						$h2p_j('div.layout-Player-announce').toggle();
						$h2p_j('div.layout-Player-rank').toggle();
						$h2p_j('div#js-player-barrage').toggleClass('h2p-top-0');
					},
					clearInfo	: ()=>{
						vue_light.isClearInfo = !vue_light.isClearInfo;
						$h2p_j('div#js-player-title').css('min-height', 'auto');
						// 头像、名称、成就、他的视频、分享
						let eles = ['div.Title-anchorPic', 'div.Title-headline', 'div.Title-impress.clearFix', 'div.Title-roomOtherTop > a.Title-videoSiteLink', 'div.Title-roomOtherBottom'];
						eles.forEach( ele => { $h2p_j(ele).toggle(); } );
						$h2p_j('div.Title').toggleClass('h2p-h-100p');
					},
					clearGift	: ()=>{
						vue_light.isClearGift = !vue_light.isClearGift;
						$h2p_j('div.layout-Player-toolbar').toggleClass('h2p-h-100p');
						let eles = ['div.PlayerToolbar-GiftWrap', 'div.PlayerToolbar-reactGroup', 'div.ToolbarActivityArea', 'div.PlayerToolbar-signCont', 'div.Title-addFriend', 'div.Title-columnTag'];
						eles.forEach( ele => { $h2p_j(ele).toggle(); } );
						$h2p_j('div.PlayerToolbar').toggleClass('h2p-padding-15');
					},
					clearAll	: ()=>{
						vue_light.isClearAll = true;
						if ( !vue_light.isClearPlay ) { vue_light.clearPlay(); }
						if ( !vue_light.isClearBar ) { vue_light.clearBar(); }
						if ( !vue_light.isClearInfo ) { vue_light.clearInfo(); }
						if ( !vue_light.isClearGift ) { vue_light.clearGift(); }
					},
					clearCancel	: ()=>{
						vue_light.isClearAll = false;
						if ( vue_light.isClearPlay ) { vue_light.clearPlay(); }
						if ( vue_light.isClearBar ) { vue_light.clearBar(); }
						if ( vue_light.isClearInfo ) { vue_light.clearInfo(); }
						if ( vue_light.isClearGift ) { vue_light.clearGift(); }
					},
					hidePS		: ()=>{
						vue_light.clearCancel();
						if ( vue_light.isHideWS ) { vue_light.hideWS(); }
						if ( vue_light.isHideFS ) { vue_light.hideFS(); }
						
						// 背景图片、主播信息、左侧边栏、竞猜、友邻、贵宾弹幕、吃鸡战绩
						let eles = ['div#js-background-holder', 'div.layout-Player-title', 'aside#js-aside', 'div#js-player-guessgame', 'div#js-bottom', 'div.Barrage-topFloater', 'div.PubgInfo'];
						eles.forEach( ele => { $h2p_j(ele).toggle(); } );

						// 斗鱼 logo、粉丝节、客户端、开播、创世幻神
						eles = ['a.Header-logo', 'div.HeaderNav', 'div.Header-download-wrap', 'div.Header-broadcast-wrap', 'span.HeaderGif-left', 'span.HeaderGif-right', 'ul.Header-menu > li:eq(1)', 'ul.Header-menu > li:gt(2)'];
						eles.forEach( ele => { $h2p_j(ele).toggle(); } );

						$h2p_j('div#js-room-activity').remove();				// 超级粉丝团
						$h2p_j('a.Barrage-toolbarClear').click();				// 清除弹幕

						$h2p_j('div#js-bottom').toggle();
						$h2p_j('div#js-room-activity').toggle();				// 分区冠军赛

						$h2p_j('div.AnchorAnnounce.h2p-h-100p > a.Title-anchorHot').toggle();

						$h2p_j(document.body).toggleClass('h2p-bg-black');

						if ( !vue_light.isHidePS ) {
							vue_light.isHidePS = true;
							vue_light.clearBar();
							vue_light.clearGift();
							vue_light.clearPlay();
							
							// 修改热度位置
							$h2p_j('div.AnchorAnnounce > a.Title-anchorHot').append( $h2p_j('div.Title-anchorInfo.clearFix > a.Title-anchorHot > div.Title-anchorText') );

							// 去除页面背景图片
							if ( window.location.href.indexOf('/topic/') > -1 ) {
								$h2p_j('div[class="bc-wrapper bc-wrapper-2"]').hide();
								$h2p_j('div#root').children('div.bc-wrapper:eq(1)').css('margin-top', '68px');
							}
				
							// 放大弹幕栏
							$h2p_j('div#js-player-barrage').css('top', '0');

							// 适配大屏
							let playWDivH = 2.07;
							let playH = parseInt($h2p_j('html').css('height').split('px')[0]) - parseInt($h2p_j('header#js-header').css('height').split('px')[0]) - 15;
							let playW = playH * playWDivH;
							$h2p_j('.layout-Main').css({
								'padding'	: '0',
								'margin'	: '5px auto'
							});
							$h2p_j('div.layout-Player').css({
								'margin'	: 'auto',
								'width'		: playW + 'px',
							});

							setTimeout(()=>{  $h2p_j('div.roomSmallPlayerFloatLayout-closeBtn').click(); }, 500);

							// 恢复正常尺寸画面
							setTimeout(() => {
								$h2p_j('div.wfs-2a8e83').click();
								setTimeout(() => { $h2p_j('div.wfs-exit-180268').click(); }, 50)
							}, 20);
						}
						else {
							vue_light.isHidePS = false;

							// 修改热度位置
							$h2p_j('div.Title-anchorInfo.clearFix > a.Title-anchorHot').append( $h2p_j('div.AnchorAnnounce > a.Title-anchorHot > div.Title-anchorText') );

							// 显示页面背景图片
							if ( window.location.href.indexOf('/topic/') > -1 ) {
								$h2p_j('div[class="bc-wrapper bc-wrapper-2"]').show();
								$h2p_j('div#root').children('div.bc-wrapper:eq(1)').css('margin-top', '0');
							}

							// 恢复弹幕栏
							$h2p_j('div#js-player-barrage').css('top', '256px');

							// 适配大屏
							$h2p_j('.layout-Main').css({
								'padding'	: '',
								'margin'	: ''
							});
							$h2p_j('div.layout-Player').css({
								'margin'	: '',
								'width'		: '',
							});

							// 恢复正常尺寸画面
							setTimeout(() => {
								$h2p_j('div.wfs-2a8e83').click();
								setTimeout(() => { $h2p_j('div.wfs-exit-180268').click(); }, 50)
							}, 20);
						}

						vue_light.Con_btn_ps = vue_light.isHidePS ? '退出部分隐藏' : '部分隐藏';
					},
					hideWS		: ()=>{
						vue_light.clearCancel();
						if ( vue_light.isHidePS ) { vue_light.hidePS(); }
						if ( vue_light.isHideFS ) { vue_light.hideFS(); }

						$h2p_j('div#js-room-activity').toggle();				// 分区冠军赛

						if ( !vue_light.isHideWS ) {
							vue_light.isHideWS = true;
							vue_light.clearBar();
							vue_light.clearGift();

							startWS = new Date().getTime();
							let setINVL_waitWS = setInterval( ()=>{
								if ( $h2p_j('div.wfs-2a8e83').length > 0 ) {
									$h2p_j('div.wfs-2a8e83').click();
									window.clearInterval(setINVL_waitWS);
									setINVL_waitWS = undefined;
								} else if ( (new Date().getTime() - startWS) > waitSec ) {
									window.clearInterval(setINVL_waitWS);
									setINVL_waitWS = undefined;
								}
							}, 200);

							// 放大弹幕栏
							$h2p_j('div#js-player-barrage').css('top', '0');
						}
						else {
							vue_light.isHideWS = false;

							startWS = new Date().getTime();
							let setINVL_waitWS = setInterval( ()=>{
								if ( $h2p_j('div.wfs-exit-180268').length > 0 ) {
									$h2p_j('div.wfs-exit-180268').click();
									window.clearInterval(setINVL_waitWS);
									setINVL_waitWS = undefined;
								} else if ( (new Date().getTime() - startWS) > waitSec ) {
									window.clearInterval(setINVL_waitWS);
									setINVL_waitWS = undefined;
								}
							}, 200);

							// 还原弹幕栏
							$h2p_j('div#js-player-barrage').css('top', '256px');
						}

						vue_light.Con_btn_ws = vue_light.isHideWS ? '退出宽屏模式' : '宽屏模式';
					},
					hideFS		: ()=>{
						if ( vue_light.isHidePS ) { vue_light.hidePS(); }
						if ( vue_light.isHideWS ) { vue_light.hideWS(); }

						$h2p_j('div#js-room-activity').toggle();				// 分区冠军赛

						if ( !vue_light.isHideFS ) {
							vue_light.isHideFS = true;

							startFS = new Date().getTime();
							let setINVL_waitFS = setInterval( ()=>{
								if ( $h2p_j('div.wfs-2a8e83').length > 0 ) {
									$h2p_j('div.wfs-2a8e83').click();
									// 隐藏弹幕框
									setTimeout(() => { $h2p_j('label.layout-Player-asidetoggleButton').click(); }, 200);
									window.clearInterval(setINVL_waitFS);
									setINVL_waitFS = undefined;
								} else if ( (new Date().getTime() - startFS) > waitSec ) {
									window.clearInterval(setINVL_waitFS);
									setINVL_waitFS = undefined;
								}
							}, 200);
						}
						else {
							vue_light.isHideFS = false;
							
							startFS = new Date().getTime();
							let setINVL_waitFS = setInterval( ()=>{
								if ( $h2p_j('div.wfs-exit-180268').length > 0 ) {
									// 显示弹幕框
									$h2p_j('label.layout-Player-asidetoggleButton').click();
									setTimeout(() => { $h2p_j('div.wfs-exit-180268').click(); }, 200);
									window.clearInterval(setINVL_waitFS);
									setINVL_waitFS = undefined;
								} else if ( (new Date().getTime() - startFS) > waitSec ) {
									window.clearInterval(setINVL_waitFS);
									setINVL_waitFS = undefined;
								}
							}, 200);
						}

						vue_light.Con_btn_fs = vue_light.isHideFS ? '退出网页全屏' : '网页全屏';
					},
				},
			});
			
			BOOL_vue_clear = true;
			window.clearInterval(INVL_createVue_clear);
			INVL_createVue_clear = undefined;
		}
	}, 100 );

	$h2p_j(document).ready().keydown(function (e) {
		// ESC 按键
		if ( e.which === 27 ) {
			if ( vue_light.isHidePS ) vue_light.hidePS();
			else if ( vue_light.isHideWS ) vue_light.hideWS();
			else if ( vue_light.isHideFS ) vue_light.hideFS();
		}
	});







	
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //
// 自动化设置
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //








	// 自动领取观看鱼丸
	var auto_getFB = () => {
		var INVL_autoGetFB = setInterval(() => {
			// 观看鱼丸元素存在并且有未领取的鱼丸
			if ( $h2p_j('div.FishpondTreasure-num.is-entrance').length > 0 && $h2p_j('div.FishpondTreasure-num.is-entrance').text().length > 0 ) {
				// 打开领取鱼丸界面
				$h2p_j('div.FishpondTreasure-icon').click();

				// 每日活跃、每周活跃
				$h2p_j('span[class^="FTP-btn"]').toArray().forEach( (span) => {
					span.click();
					$h2p_j('div.FTP-singleTask-btn.is-finished').toArray().forEach( ele => ele.click() );
				} );
				// 鱼塘
				$h2p_j('div.FTP-bubble-progressText.is-complete').toArray().forEach( ele => ele.click() );

				$h2p_j('span.FTP-close').click();
			}
		}, 5000);
	};

	// 自动签到
	var auto_signIn = () => {
		let INVL_checkSignInIconReady = setInterval( () => {
			if ( $h2p_j('div.RoomLevelDetail-level.RoomLevelDetail-level--no').length > 0 ) {
				window.clearInterval(INVL_checkSignInIconReady);
				INVL_checkSignInIconReady = undefined;
				$h2p_j('div.RoomLevelDetail-level.RoomLevelDetail-level--no').click();
			}
		}, 200);
	}

	// 默认画质
	var auto_showDef = () => {
		let INVL_checkDefIconReady = setInterval( () => {
			if ( $h2p_j('div.rate-5c068c').length > 0 ) {
				window.clearInterval(INVL_checkDefIconReady);
				INVL_checkDefIconReady = undefined;
				if ( h2p_DYScript_config.isShow0 ) {
					$h2p_j('div.tip-e3420a > ul > li:last').click();
				} else if ( h2p_DYScript_config.isShow9 ) {
					$h2p_j('div.tip-e3420a > ul > li:first').click();					
				}
			}
		}, 200 );
	}

	// 火力全开
	var auto_onFire = () => {
		let INVL_autoOnFire = setInterval( () => {
			if ( $h2p_j('div.FirePower').length > 0 && $h2p_j('div.FirePower > span').length > 0 && $h2p_j('div.FirePower > span').attr('class').indexOf('on-fire') < 0 ) {
				$h2p_j('div.FirePower > span').click();
				setTimeout( ()=>{ $h2p_j('a.FirePowerChatModal-close').click(); }, 200)
			}
		}, 5000);
	}

	// 检测是否出现 在电脑面前检测
	setInterval( ()=>{ $h2p_j('div.btn2-869c8d').toArray().forEach( ele => ele.click() ); }, 10000 );
	// 检测是否出现 重新加载
	setInterval( ()=>{
		if ( $h2p_j('div.reload-0876b5').css('display') != 'none' ) { $h2p_j('div.reload-0876b5').toArray().forEach( ele => ele.click() );  }
	}, 10000 );







// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //
// 脚本自动化配置界面
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //









	// 初始化配置界面
	(()=>{
		var str_div_config = (()=>{/*
			<div id="div-config" class="h2p-div-inlinepanel" style="display: none">
				<div class="h2p-div-layer" style="text-align: center;">
					<label>自动化配置</label>
				</div>

				<hr style="margin: 6px -9px; border: 1px solid #DCDCDC;">

				<div class="h2p-div-layer">
					<!-- 是否自动发送抄袭弹幕 -->
					<div class="h2p-div-layer-half">
						<input id="input-auto-copyBar" class="h2p-checkbox-left" type="checkbox" :checked="auto_isCopy" @click="click_autoCopyBar" />
						<label class="h2p-label-checkbox-left">抄袭弹幕</label>
					</div>

					<!-- 是否自动发送循环弹幕 -->
					<div class="h2p-div-layer-half" style="left: 50%">
						<input id="input-auto-loopBar" class="h2p-checkbox-left" type="checkbox" :checked="auto_isLoop" @click="click_autoLoopBar" />
						<label class="h2p-label-checkbox-left">循环弹幕</label>
					</div>
				</div>

				<hr style="margin: 6px; border: 1px solid transparent;">

				
				<div class="h2p-div-layer">
					<!-- 是否自动发送循环弹幕 -->
					<div class="h2p-div-layer-half">
						<input id="input-auto-keyReply" class="h2p-checkbox-left" type="checkbox" :checked="auto_isKeyReply" @click="click_autoKeyReply" />
						<label class="h2p-label-checkbox-left">关键词回复</label>
					</div>

					<!-- 是否自动发送抽奖弹幕 -->
					<div class="h2p-div-layer-half" style="left: 50%">
						<input id="input-auto-luckDraw" class="h2p-checkbox-left" type="checkbox" :checked="auto_isLuckDraw" @click="click_autoLuckDraw" />
						<label class="h2p-label-checkbox-left">抽奖弹幕</label>
					</div>
				</div>

				<hr style="margin: 6px; border: 1px solid transparent;">

				<!-- 隐藏选项 和 画质选项 -->
				<div class="h2p-div-layer">
					<div class="h2p-div-layer-half">
						<input id="input-auto-hideMode" class="h2p-checkbox-left" type="checkbox" :checked="auto_isHide" @click="click_autoHideMode" />
						<select id="select-hideMode" class="h2p-label-checkbox-left" style="width: 80%; height: 24px;" @change="click_selectHideMode">
							<option v-for="hideMode in hideModes" :value="hideMode.value">{{hideMode.text}}</option>
						</select>
					</div>
					<div class="h2p-div-layer-half" style="left: 50%">
						<input id="input-auto-showDef" class="h2p-checkbox-left" type="checkbox" :checked="auto_isShow" @click="click_autoShowDef" />
						<select id="select-showDef" class="h2p-label-checkbox-left" style="width: 80%; height: 24px;" @change="click_selectShowDef">
							<option v-for="showDef in showDefs" :value="showDef.value">{{showDef.text}}</option>
						</select>
					</div>
				</div>

				<hr style="margin: 6px; border: 1px solid transparent;">

				<!-- 是否自动领取鱼丸和签到 -->
				<div class="h2p-div-layer">
					<div class="h2p-div-layer-half">
						<input id="input-auto-getFB" class="h2p-checkbox-left" type="checkbox" :checked="auto_getFB" @click="click_autoGetFB" />
						<label class="h2p-label-checkbox-left">自动领取鱼丸</label>
					</div>
					<div class="h2p-div-layer-half" style="left: 50%;">
						<input id="input-auto-signIn" class="h2p-checkbox-left" type="checkbox" :checked="auto_signIn" @click="click_autoSignIn" />
						<label class="h2p-label-checkbox-left">自动签到</label>
					</div>
				</div>

				<hr style="margin: 6px; border: 1px solid transparent;">

				<!-- 是否自动参加火力全开 -->
				<div class="h2p-div-layer">
					<div class="h2p-div-layer-half">
						<input id="input-auto-onFire" class="h2p-checkbox-left" type="checkbox" :checked="auto_onFire" @click="click_autoOnFire" />
						<label class="h2p-label-checkbox-left">参与火力全开</label>
					</div>
				</div>
			</div>
		*/}).toString().split('/*')[1].split('*/')[0].replace(/[\n]/g, '');
		var div_config = $h2p_j(str_div_config);

		$h2p_j(div_DYScript).append(div_config);

		var check_mountPoint_configIcon = setInterval( ()=>{
			if ( $h2p_j('div#div-config').length > 0 ) {
				window.clearInterval( check_mountPoint_configIcon );
				check_mountPoint_configIcon = undefined;
				BOOL_ok_config = true;
			}
		}, 1000);
	})();

	window.vue_config = undefined;
	// 发送弹幕组件构建 Vue
	var INVL_createVue_config = setInterval( ()=>{
		if ( BOOL_ok_config ) {
			vue_config = new Vue({
				el		: '#div-config',
				data	: {
					auto_isCopy		: false,
					auto_isLoop		: false,
					auto_isKeyReply	: false,
					auto_isLuckDraw	: false,
					auto_isHide		: false,
					auto_isHidePS	: false,
					auto_isHideWS	: false,
					auto_isHideFS	: false,
					auto_isShow		: false,
					auto_isShow0	: false,		// 最低画质
					auto_isShow9	: false,		// 最高画质
					auto_getFB		: false,		// 自动获取鱼丸(fish ball)
					auto_signIn		: false,
					auto_onFire		: false,
					hideModes		: [
						{ 'value' : 'hidePS', 'text' : '隐藏部分' },		// part screen
						{ 'value' : 'hideWS', 'text' : '宽屏模式' },		// wide screen
						{ 'value' : 'hideFS', 'text' : '网页全屏' },		// full screen
					],
					showDefs		: [
						{ 'value' : 'showLow', 'text' : '最低画质' },
						{ 'value' : 'showBest', 'text' : '最高画质' },
					]
				},
				methods	: {
					click_autoCopyBar	: ()=>{
						vue_config.auto_isCopy = !vue_config.auto_isCopy;
						h2p_DYScript_config.isCopy = vue_config.auto_isCopy;
						localStorage.setItem('h2p-DYScript-config', JSON.stringify(h2p_DYScript_config) );
					},
					click_autoLoopBar	: ()=>{
						vue_config.auto_isLoop = !vue_config.auto_isLoop;
						h2p_DYScript_config.isLoop = vue_config.auto_isLoop;
						localStorage.setItem('h2p-DYScript-config', JSON.stringify(h2p_DYScript_config) );
					},
					click_autoKeyReply	: ()=>{
						vue_config.auto_isKeyReply = !vue_config.auto_isKeyReply;
						h2p_DYScript_config.isKeyReply = vue_config.auto_isKeyReply;
						localStorage.setItem('h2p-DYScript-config', JSON.stringify(h2p_DYScript_config) );
					},
					click_autoLuckDraw	: ()=>{
						vue_config.auto_isLuckDraw = !vue_config.auto_isLuckDraw;
						h2p_DYScript_config.isLuckDraw = vue_config.auto_isLuckDraw;
						localStorage.setItem('h2p-DYScript-config', JSON.stringify(h2p_DYScript_config) );
					},
					click_autoHideMode	: ()=>{
						vue_config.auto_isHide = !vue_config.auto_isHide;
						vue_config.click_selectHideMode();
					},
					// 选择隐藏模式
					click_selectHideMode: ()=>{
						vue_config.auto_isHidePS = false;
						vue_config.auto_isHideWS = false;
						vue_config.auto_isHideFS = false;

						if ( vue_config.auto_isHide ) {
							let value = $h2p_j('select#select-hideMode > option:selected').val();
							if ( value == 'hidePS' ) { vue_config.auto_isHidePS = true; }
							else if ( value == 'hideWS' ) { vue_config.auto_isHideWS = true; }
							else if ( value == 'hideFS' ) { vue_config.auto_isHideFS = true; }
						}
						h2p_DYScript_config.isHidePS = vue_config.auto_isHidePS;
						h2p_DYScript_config.isHideWS = vue_config.auto_isHideWS;
						h2p_DYScript_config.isHideFS = vue_config.auto_isHideFS;
						localStorage.setItem('h2p-DYScript-config', JSON.stringify(h2p_DYScript_config) );
					},
					click_autoShowDef	: ()=>{
						vue_config.auto_isShow = !vue_config.auto_isShow;
						vue_config.click_selectShowDef();
					},
					// 选择隐藏模式
					click_selectShowDef: ()=>{
						vue_config.auto_isShow0 = false;
						vue_config.auto_isShow9 = false;

						if ( vue_config.auto_isShow ) {
							let value = $h2p_j('select#select-showDef > option:selected').val();
							if ( value == 'showLow' ) { vue_config.auto_isShow0 = true; }
							else if ( value == 'showBest' ) { vue_config.auto_isShow9 = true; }
						}
						h2p_DYScript_config.isShow0 = vue_config.auto_isShow0;
						h2p_DYScript_config.isShow9 = vue_config.auto_isShow9;
						localStorage.setItem('h2p-DYScript-config', JSON.stringify(h2p_DYScript_config) );
					},
					click_autoGetFB	: ()=>{
						vue_config.auto_getFB = !vue_config.auto_getFB;
						h2p_DYScript_config.getFB = vue_config.auto_getFB;
						localStorage.setItem('h2p-DYScript-config', JSON.stringify(h2p_DYScript_config) );
					},
					click_autoSignIn: ()=>{
						vue_config.auto_signIn = !vue_config.auto_signIn;
						h2p_DYScript_config.signIn = vue_config.auto_signIn;
						localStorage.setItem('h2p-DYScript-config', JSON.stringify(h2p_DYScript_config) );
					},
					click_autoOnFire: ()=>{
						vue_config.auto_onFire = !vue_config.auto_onFire;
						h2p_DYScript_config.onFire = vue_config.auto_onFire;
						localStorage.setItem('h2p-DYScript-config', JSON.stringify(h2p_DYScript_config) );
					},
				}
			});

			BOOL_vue_config = true;
			window.clearInterval(INVL_createVue_config);
			INVL_createVue_config = undefined;
		}
	}, 100);

	// 检查弹幕图标挂载点(斗鱼弹幕输入框)是否加载完成
	var check_mountPoint_DYScriptIcon = setInterval( ()=>{
		if ( $h2p_j('div#div-DYScript').length > 0 && $h2p_j('div.BarrageSuperLink').length > 0 ) {
			let div_sign = $h2p_j('<div class="h2p-div-sign" style="margin: -8px 0 0 -3px;" title="斗鱼脚本"></div>');

			let btn_sign = $h2p_j('<span id="button-DYScript" class="h2p-span-sign">🐯</span>');
			$h2p_j(btn_sign).click(()=>{ $h2p_j('div#div-DYScript').toggle(); });
			$h2p_j(div_sign).append(btn_sign);

			$h2p_j('div.ChatToolBar').append( div_sign );
			window.clearInterval(check_mountPoint_DYScriptIcon);
		}
	}, 500);

	$h2p_j(div_DYScript).append(div_DYScriptTab);








// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //
// 获取自动化配置
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //








	// 斗鱼功能自动化配置
	var h2p_DYScript_config = undefined;
	var h2p_DYScript_config_def = {
		speedMin	: 6000,
		speedMax	: 7000,
		isCopy		: false,
		INVL_copy	: 0,
		isLoop	 	: false,
		loopBarCon	: '',
		isKeyReply	: false,
		keyReplys	: [],
		isLuckDraw	: false,
		CNT_luckDraw: 2,
		isHidePS 	: false,
		isHideWS	: false,
		isHideFS 	: false,
		isShow0		: false,
		isShow9		: false,
		getFB		: false,
		signIn		: false,
		onFire		: false,
		showTs		: [],
	};

	
	(()=>{
		if ( window.location.href.indexOf('topic') > 0 ) {
			roomInfo.id = window.location.href.split('=').pop();
		} else {
			roomInfo.id = window.location.pathname.split('/').pop();
		}
		let INVL_getAnchorShowT = setInterval(()=>{
			if ( h2p_DYScript_config ) {
				let showTs = h2p_DYScript_config.showTs;
				let showT = 0;
				let getT = 0;
				let isStore = false;
				let index = 0;
				for ( ; index < showTs.length; index++ ) {
					if ( roomInfo.id == showTs[index].id ) {
						showT = parseInt( showTs[index].showT );
						getT = parseInt( showTs[index].getT );
						isStore = true;
						break;
					}
				}
				let INVL = ((new Date().getTime() / 1000) - getT) / 3600.0;
				if ( INVL < 6 ) {
					roomInfo.showT = showT;
					console.log(`Succeed getting anchor showTime : ${roomInfo.showT}.`);
				} else {
					$h2p_j.ajax({
						url		: 'https://www.douyu.com/swf_api/h5room/' + roomInfo.id,
						success	: (response)=>{
							let res = JSON.parse( JSON.stringify(response) );
							try {
								if ( res.data.show_time ) {
									roomInfo.showT = parseInt( res.data.show_time );
									console.log(`Succeed getting anchor showTime : ${roomInfo.showT}.`);
									let info = { 'id' : roomInfo.id, 'showT' : roomInfo.showT, "getT" : parseInt( new Date().getTime() / 1000 ) };
									if ( isStore ) { h2p_DYScript_config.showTs.splice(index, 1, info); }
									else { h2p_DYScript_config.showTs.push(info); }
									localStorage.setItem('h2p-DYScript-config', JSON.stringify(h2p_DYScript_config) );
								} else { console.log('Fail to get anchor showTime.') }
							} catch(e){ console.log('获取播放时间失败。') }
						},
					});
				}

				window.clearInterval(INVL_getAnchorShowT);
				INVL_getAnchorShowT = undefined;
			}
		}, 500);

		try{
			// 获取本地用户配置
			let settingValue = JSON.parse( localStorage.getItem('h2p-DYScript-config') );
			if ( !settingValue ) {
				settingValue = JSON.parse( localStorage.getItem('h2p-DYScript-setting') );
				localStorage.removeItem('h2p-DYScript-setting');
			}
			h2p_DYScript_config = JSON.parse( JSON.stringify(h2p_DYScript_config_def) );

			for ( let attr in settingValue ) {
				if ( attr in h2p_DYScript_config ) {
					h2p_DYScript_config[attr] = settingValue[attr];
				}
			}

			if ( 'loopBarrage' in settingValue ) { h2p_DYScript_config.isLoop = settingValue.loopBarrage; }
			if ( 'loopBarContext' in settingValue ) { h2p_DYScript_config.loopBarCon = settingValue.loopBarContext; }
			if ( 'copyBarrage' in settingValue ) { h2p_DYScript_config.isCopy = settingValue.copyBarrage; }
			if ( 'luckDrawBarrage' in settingValue ) { h2p_DYScript_config.isLuckDraw = settingValue.luckDrawBarrage; }
			if ( 'receiveFishBall' in settingValue ) { h2p_DYScript_config.getFB = settingValue.receiveFishBall; }
			if ( 'hidePart' in settingValue ) { h2p_DYScript_config.isHidePS = settingValue.hidePart; }
			if ( 'hideWS' in settingValue ) { h2p_DYScript_config.isHideWS = settingValue.hideWS; }
			if ( 'hideAll' in settingValue ) { h2p_DYScript_config.isHideFS = settingValue.hideAll; }

			localStorage.setItem('h2p-DYScript-config', JSON.stringify(h2p_DYScript_config) );
		} catch (err) {
			// 重置本地配置
			console.log('重置本地配置');
			localStorage.removeItem('h2p-DYScript-config');
			h2p_DYScript_config = h2p_DYScript_config_def;
			localStorage.setItem('h2p-DYScript-config', JSON.stringify(h2p_DYScript_config) );
        }

        // 根据 cookie 获取用户昵称
		let cookies = document.cookie.split(/;\s/g);
		for ( let i = 0; i < cookies.length; i++ ) {
			let cookie = cookies[i];
			let keyVal = cookie.split('=');
			if ( keyVal && keyVal.length == 2 && keyVal[0] == 'acf_nickname' ) {
				userInfo.nickName = keyVal[1];
				break;
			}
		}

		BOOL_ok_localS = true;
	})();

	// 自动获取已有徽章的主播
	var roomOfAnchorFan = [];
	setTimeout( () => {
		$h2p_j('html').append('<div id="FansBadgeList" style="display: none"></div>');
		setTimeout( () => {
			// 获取有粉丝牌的主播房间号
			$h2p_j('div#FansBadgeList').load('/member/cp/getFansBadgeList [class="aui_room_table fans-badge-list"]');
			setTimeout( () => {
				let ele_anchors = $h2p_j('div#FansBadgeList > table > tbody > tr');
				for ( let i = 0; i < ele_anchors.length; i++ ) {
					let ele = ele_anchors[i];
					let anchorURL = $h2p_j(ele).children('td:eq(1)').children('a:eq(0)').attr('href');
					let anchorRoom = anchorURL.split('/').pop();
					roomOfAnchorFan[i] = anchorRoom;
				}
				let anchorRoom= window.location.href.split('/').pop();
				userInfo.isAnchorFan = roomOfAnchorFan.indexOf(anchorRoom) > -1;
				console.log(`有粉丝牌的主播房间号${JSON.stringify(roomOfAnchorFan)}`);
			}, 3000);
		}, 200)
	}, 1000);








// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //
// 	应用自动化配置
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //









	(()=>{
		// 自动发弹幕自动化设置生效
		var INVL_config_bar_work = setInterval(()=>{
			if ( BOOL_vue_sendBar && BOOL_vue_config && BOOL_ok_localS ) {
				let auto_send = false;
				vue_sendBar.speedMin	= h2p_DYScript_config.speedMin;
				vue_sendBar.speedMax	= h2p_DYScript_config.speedMax;
				if ( h2p_DYScript_config.isCopy ) {
					vue_sendBar.isCopy = true;
					vue_config.auto_isCopy = true;
					auto_send = true;
				}
				if ( h2p_DYScript_config.isLoop ) {
					vue_sendBar.isLoop = true;
					vue_config.auto_isLoop = true;
					auto_send = true;
				}
				if ( h2p_DYScript_config.isKeyReply ) {
					vue_sendBar.isKeyReply = true;
					vue_config.auto_isKeyReply = true;
					auto_send = true;
				}
				if ( h2p_DYScript_config.keyReplys ) {
					for ( let i = 0; i < h2p_DYScript_config.keyReplys.length; i++ ) {
						vue_sendBar.keyReplys.push( h2p_DYScript_config.keyReplys[i] );
					}
				}
				if ( h2p_DYScript_config.isLuckDraw ) {
					vue_sendBar.isLuckDraw = true;
					vue_config.auto_isLuckDraw = true;
					auto_send = true;
				}
				$h2p_j('input#input-copyBar-interval').val(h2p_DYScript_config.INVL_copy);
				$h2p_j('textarea#input-loopBar-content').val(h2p_DYScript_config.loopBarCon);

				if ( auto_send ) { $h2p_j('button#btn-sendBar').click(); }
				window.clearInterval(INVL_config_bar_work);
			}
		}, 500);

		// 清爽模式自动化设置生效
		var INVL_config_clear_work = setInterval(()=>{
			if ( BOOL_vue_clear && BOOL_ok_localS ) {
				if ( h2p_DYScript_config.isHidePS ) {
					vue_config.auto_isHide = true;
					vue_config.auto_isHidePS = true;
					$h2p_j('select#select-hideMode > option[value="hidePS"]').attr('selected', true);
					vue_light.hidePS();
					console.log('启动:隐藏部分');
				}
				else if ( h2p_DYScript_config.isHideWS ) {
					vue_config.auto_isHide = true;
					vue_config.auto_isHideWS = true;
					$h2p_j('select#select-hideMode > option[value="hideWS"]').attr('selected', true);
					vue_light.hideWS();
					console.log('启动:宽屏模式');
				}
				else if ( h2p_DYScript_config.isHideFS ) {
					vue_config.auto_isHide = true;
					vue_config.auto_isHideFS = true;
					$h2p_j('select#select-hideMode > option[value="hideFS"]').attr('selected', true)
					vue_light.hideFS();
					console.log('启动:网页全屏');
				}
				window.clearInterval(INVL_config_clear_work);
			}
		}, 500);

		// 最低(高)画质自动化设置生效
		var INVL_config_showDef_work = setInterval(()=>{
			if ( BOOL_vue_config && ( h2p_DYScript_config.isShow0 || h2p_DYScript_config.isShow9 ) ) {
				auto_showDef();
				vue_config.auto_isShow = true;
				console.log('启动:自动' + ( h2p_DYScript_config.isShow0 ? '最低画质' : '最高画质' ) );
				window.clearInterval(INVL_config_showDef_work);
			} else if ( BOOL_vue_config && !h2p_DYScript_config.isShow0 && !h2p_DYScript_config.isShow9 ) {
				console.log('自动画质 启动程序 已关闭');
				window.clearInterval(INVL_config_showDef_work);
			}
		}, 500);

		// 领取鱼丸自动化设置生效
		var INVL_config_getFB_work = setInterval(()=>{
			if ( BOOL_vue_config && h2p_DYScript_config.getFB ) {
				auto_getFB();
				vue_config.auto_getFB = true;
				console.log('启动:自动领取观看鱼丸');
				window.clearInterval(INVL_config_getFB_work);
			} else if ( BOOL_vue_config && !h2p_DYScript_config.getFB ) {
				console.log('自动领取观看鱼丸 启动程序 已关闭');
				window.clearInterval(INVL_config_getFB_work);
			}
		}, 500);

		// 签到自动化设置生效
		var INVL_config_signIn_work = setInterval(()=>{
			if ( BOOL_vue_config && h2p_DYScript_config.signIn ) {
				auto_signIn();
				vue_config.auto_signIn = true;
				console.log('启动:自动签到');
				window.clearInterval(INVL_config_signIn_work);
			} else if ( BOOL_vue_config && !h2p_DYScript_config.signIn ) {
				console.log('自动签到 启动程序 已关闭');
				window.clearInterval(INVL_config_signIn_work);
			}
		}, 500);

		// 火力全开自动化设置生效
		var INVL_config_onFire_work = setInterval(()=>{
			if ( BOOL_vue_config && h2p_DYScript_config.onFire ) {
				auto_onFire();
				vue_config.auto_onFire = true;
				console.log('启动:自动火力全开');
				window.clearInterval(INVL_config_onFire_work);
			} else if ( BOOL_vue_config && !h2p_DYScript_config.onFire ) {
				console.log('自动火力全开 启动程序 已关闭');
				window.clearInterval(INVL_config_onFire_work);
			}
		}, 500);
	})();
})();