📝全网VIP视频破解去广告免费看【自动解析&自动|手动去广告版】

支持优酷、爱奇艺、腾讯、B站(bilibili)、乐视、芒果等各大视频网站视频解析服务,可自行选择解析线路自动解析,可自行选择去除广告,超级方便。

// ==UserScript==
// @name              📝全网VIP视频破解去广告免费看【自动解析&自动|手动去广告版】
// @namespace         https://www.idey.cn
// @version           1.1.4
// @author            idey
// @description      支持优酷、爱奇艺、腾讯、B站(bilibili)、乐视、芒果等各大视频网站视频解析服务,可自行选择解析线路自动解析,可自行选择去除广告,超级方便。
// @match        	*://v.qq.com/*
// @match        	*://m.v.qq.com/*
// @match        	*://*.iqiyi.com/*
// @match        	*://*.iq.com/*
// @match           *://*.youku.com/v_*
// @match        	*://*.le.com/*
// @match        	*://*.tudou.com/*
// @match       	*://*.mgtv.com/*
// @match        	*://tv.sohu.com/*
// @match        	*://film.sohu.com/*
// @match        	*://*.1905.com/*
// @match        	*://*.bilibili.com/*
// @match        	*://*.pptv.com/*
// @match        *://item.taobao.com/*
// @match        *://chaoshi.detail.tmall.com/*
// @match        *://detail.tmall.com/*
// @match        *://detail.tmall.hk/*
// @match        *://*.jd.com/*
// @match        *://*.jd.hk/*
// @match        *://*.yiyaojd.com/*
// @match        *://*.liangxinyao.com/*
// @require      	http://libs.baidu.com/jquery/2.0.0/jquery.min.js
// @require         https://unpkg.com/sweetalert2@10.16.6/dist/sweetalert2.all.min.js
// @require      	https://cdn.bootcss.com/jquery.qrcode/1.0/jquery.qrcode.min.js
// @require     	http://code.jquery.com/ui/1.11.0/jquery-ui.min.js
// @connect           *
// @connect        idey.cn
// @grant           GM_xmlhttpRequest
// @grant           GM_info
// @grant             GM_getValue
// @grant             GM_setValue
// @grant             GM.getValue
// @grant             GM.setValue
// @grant             GM_openInTab
// @grant             GM.openInTab
// @grant       unsafeWindow
// @run-at      document-start
// @license         AGPL
// ==/UserScript==
(function() {
	'use strict';
	const conf = {
		isOpenVideo: 1, //1开启视频解析,0:关闭视频解析
		isHbCode:1,//开启优惠劵,0:关闭优惠劵
		isMobile: /Android|webOS|iPhone|iPod|BlackBerry/i.test(navigator.userAgent),
		href: location.href,
		webfilter: null,
		webList:[
					{fname:'video',name:"qq",match:/https:\/\/v.qq.com\/x\/cover\/[a-zA-Z0-9]+.html/,node:"#player-container|#mod_player|.container-player"},
					{fname:'video',name:"qq",match:/https:\/\/v.qq.com\/x\/cover\/[a-zA-Z0-9]+\/[a-zA-Z0-9]+.html/,node:"#player-container|#mod_player|.container-player"},
					{fname:'video',name:"qq",match:/v\.qq\.com\/x\/page/,node:"#player-container|#mod_player|.container-player"},
					{fname:'video',name:"mqq",match:/m\.v\.qq\.com\/x\/m\/play\?cid/,node:"#player"},
					{fname:'video',name:"mqq",match:/m\.v\.qq\.com\/x\/play\.html\?cid=/,node:"#player"},
					{fname:'video',name:"mqq",match:/m\.v\.qq\.com\/play\.html\?cid\=/,node:"#player"},
					{fname:'video',name:"mqq",match:/m\.v\.qq\.com\/cover\/.*html/,node:"#player"},
					{fname:'video',name:"iqiyi",match:/^https:\/\/www\.iqiyi\.com\/[vwa]\_/,node:"#flashbox"},
					{fname:'video',name:"miqiyi",match:/^https:\/\/m.iqiyi\.com\/[vwa]\_/,node:".m-video-player-wrap"},
					{fname:'video',name:"iqiyi",match:/^https:\/\/www\.iq\.com\/play\//,node:".intl-video-wrap"},
					{fname:'video',name:"myouku",match:/m\.youku\.com\/alipay_video\/id_/,node:"#player"},
					{fname:'video',name:"myouku",match:/m\.youku\.com\/video\/id_/,node:"#player"},
					{fname:'video',name:"youku",match:/v\.youku\.com\/v_show\/id_/,node:"#player"},
					{fname:'video',name:"bilibili",match:/www\.bilibili\.com\/video/,node:"#bilibili-player"},
					{fname:'video',name:"bilibili",match:/www\.bilibili\.com\/bangumi/,node:"#player_module"},
					{fname:'video',name:"mbilibili",match:/m\.bilibili\.com\/bangumi/,node:".player-container"},
					{fname:'video',name:"mbilibili",match:/m\.bilibili\.com\/video\//,node:".mplayer"},
					{fname:'video',name:"mmgtv",match:/m\.mgtv\.com\/b/,node:".video-area"},
					{fname:'video',name:"mgtv",match:/mgtv\.com\/b/,node:"#mgtv-player-wrap"},
					{fname:'video',name:"sohu",match:/tv\.sohu\.com\/v/,node:".x-player"},
					{fname:'video',name:"msohu",match:/m\.tv\.sohu\.com/,node:".x-cover-playbtn-wrap"},
					{fname:'video',name:"msohu",match:/film\.sohu\.com\/album\//,node:"#playerWrap"},
					{fname:'video',name:"le",match:/le\.com\/ptv\/vplay\//,node:"#le_playbox"},
					{fname:'video',name:"tudou",match:/play\.tudou\.com\/v_show\/id_/,node:"#player"},
					{fname:'video',name:"pptv",match:/v\.pptv\.com\/show\//,node:"#pptv_playpage_box"},
					{fname:'video',name:"1905",match:/vip\.1905.com\/play\//,node:"#player"},
					{fname:'video',name:"1905",match:/www\.1905.com\/vod\/play\//,node:"#vodPlayer"},
					
					{fname:'hbcode',name:"taobao",match:/item\.taobao\.com/,node:".tb-promo-meta|.tb-meta"},
					{fname:'hbcode',name:"taobao",match:/^https?:\/\/chaoshi.detail.tmall.com\//,node:".tm-fcs-panel"},
					{fname:'hbcode',name:"taobao",match:/^https?:\/\/detail\.tmall\.com/,node:".Promotion--root--3qHQalP|.tm-fcs-panel"},
					{fname:'hbcode',name:"taobao",match:/^https?:\/\/detail\.tmall\.hk/,node:".tm-fcs-panel"},
					{fname:'hbcode',name:"jd",match:/item\.jd\.com/,node:".summary-price-wrap"},
					{fname:'hbcode',name:"jd",match:/npcitem\.jd\.hk/,node:".summary-price-wrap"},
					{fname:'hbcode',name:"jd",match:/\.yiyaojd\.com/,node:".summary-price-wrap"},
					{fname:'hbcode',name:"jd",match:/item\.jkcsjd\.com/,node:".summary-price-wrap"},
					{fname:'hbcode',name:"search",match:/search\.jd\.com\/Search/,node:"#J_goodsList li|.m-aside .aside-bar li|.goods-chosen-list li|.may-like-list li|#plist li"},
					{fname:'hbcode',name:"search",match:/coll\.jd\.com\/list\.html/,node:"#J_goodsList li|.m-aside .aside-bar li|.goods-chosen-list li|.may-like-list li|#plist li"},
					{fname:'hbcode',name:"search",match:/search\.jd\.hk\/Search/,node:"#J_goodsList li|.m-aside .aside-bar li|.goods-chosen-list li|.may-like-list li|#plist li|.r-list>div"},
					{fname:'hbcode',name:"miaosha",match:/miaosha\.jd\.com/,node:".seckill_mod_goodslist li|.quark-5d5d037c7b8430d53c5fad81__goods-list>div|.quark-5d5d037c7b8430d53c5fad81__box>div"},
					




				],
		getWebFilter: () => {
			let list = conf.webList.filter(function(item) {
				return conf.href.match(item.match);
			})
			return list[0];
		},

	};
	const tool = {
		sleep: (time) => {
			return new Promise((resolve) => setTimeout(resolve, time));
		},
		get: async (url, headers, type, extra) => {
			return new Promise((resolve, reject) => {
				let req = GM_xmlhttpRequest({
					method: "GET",
					url,
					headers,
					responseType: type || 'json',
					onload: (res) => {
						if (res.status === 204) {
							req.abort();
						}
						if (type === 'blob') {
							resolve(res);
						} else {
							resolve(res.response || res.responseText);
						}
					},
					onerror: (err) => {
						reject(err);
					}
				});
			})
		},
		GMopenInTab: (url, target) => {
			if (typeof GM_openInTab === "function") {
				GM_openInTab(url, target);
			} else {
				GM.openInTab(url, target);
			}
		},
		GetQueryString:(name)=> {
			var reg = eval("/" + name + "/g");
			var r = window.location.search.substr(1);
			var flag = reg.test(r);
			if (flag) {
				return true;
			} else {
				return false;
			}
		},
		GMsetValue: (key, value) => {
			if (typeof GM_setValue === "function") {
				GM_setValue(key, value);
			} else if (typeof GM_setValue === "function") {
				GM.setValue(key, value);
			} else {
				localStorage.setItem(key, value);
			}
		},
		GMgetValue: (key) => {
			if (typeof GM_getValue === "function") {
				return GM_getValue(key);
		 } else if (typeof GM.getValue === "function") {
				return GM.getValue(key);
			} else {
				localStorage.getItem(key);
			}
		},

		addStyle: (data, id = null) => {
			let style = document.createElement('style');
			style.textContent = data;
			style.type = 'text/css';
			style.id = id;
			let doc = document.head || document.documentElement;
			doc.appendChild(style);
		},
		loadStyle: (url) => {
			let link = document.createElement("link");
			link.type = "text/css";
			link.rel = "stylesheet";
			link.href = url;
			document.getElementsByTagName("head")[0].appendChild(link);
		},
		GMxmlhttpRequest: (obje) => {
			if (typeof GM_xmlhttpRequest === "function") {
				GM_xmlhttpRequest(obje);
			} else {
				GM.xmlhttpRequest(obje);
			}
		},


	};

	const video = {
		player: '',
		autoPlayer: tool.GMgetValue('ISAUTOPLAYER_VIDEO'),
		isAuto: tool.GMgetValue('ISAUTO_VIDEO'),
		isCloseAd: tool.GMgetValue('ISCLOSEAD'),
		playerParse: $(
			"<div id='iframe-play-div' style='width:100%;height:100%;z-index:1000;position: absolute;top:0px;padding:0px;'><iframe id='iframe-player' frameborder='0' allowfullscreen='true' width='100%' height='100%'></iframe></div>"
			),
		playerList:[
					{"name": "M3U8TV", "type": "1-2-3", "url": "https://jx.m3u8.tv/jiexi/?url="},
		            {"name": "Player-JY", "type": "1-2-3", "url": "https://jx.playerjy.com/?url="},
		            {"name": "虾米", "type": "1-2-3", "url": "https://jx.xmflv.com/?url="},
					{"name": "PM", "type": "1-2-3", "url": "https://www.playm3u8.cn/jiexi.php?url="},
					{"name": "思古3", "type": "1-2", "url": "https://jsap.attakids.com/?url="},
					{"name": "听乐", "type": "1-2-3", "url": "https://jx.dj6u.com/?url="},
					{"name": "云析", "type": "1-2", "url": "https://jx.yparse.com/index.php?url="},
					{"name": "nnxv", "type": "2", "url": "https://jx.nnxv.cn/tv.php?url="},
					{"name": "RDHK", "type": "1-2-3", "url": "https://jx.rdhk.net/?v="},
		            {"name": "MAO", "type": "1-2-3", "url": "https://www.mtosz.com/m3u8.php?url="},
		            {"name": "爱豆", "type": "1-2", "url": "https://jx.aidouer.net/?url="},
		            {"name": "1717", "type": "1-3", "url": "https://ckmov.ccyjjd.com/ckmov/?url="},
		            {"name": "qianqi", "type": "1-2-3", "url": "https://api.qianqi.net/vip/?url="},
		            {"name": "laobandq", "type": "1-2-3", "url": "https://vip.laobandq.com/jiexi.php?url="},
		            {"name": "盘古", "type": "1-2-3", "url": "https://go.yh0523.cn/y.cy?url="},
		            {"name": "解析la", "type": "1-2", "url": "https://api.jiexi.la/?url="},
		            {"name": "H8", "type": "1-2-3", "url": "https://www.h8jx.com/jiexi.php?url="},
		            {"name": "17云", "type": "1-2-3", "url": "https://www.1717yun.com/jx/ty.php?url="},
					{"name":"ckmov","type": "1-2-3","url":"https://www.ckmov.vip/api.php?url="},
					{"name":"playerjy","type": "2-3","url":"https://jx.playerjy.com/?url="},
					{"name":"诺诺","type": "1-2-3","url":"https://www.ckmov.com/?url="},
					{"name":"BL","type": "1-2-3","url":"https://vip.bljiex.com/?v="},
					{"name":"8090","type": "1-2-3","url":"https://www.8090g.cn/?url="},
					{"name":"诺讯","type": "1-2-3","url":"https://www.nxflv.com/?url="},
					{"name": "Blbo", "type": "3", "url": "https://jx.blbo.cc:4433/?url="},
		            {"name": "无名小站", "type": "1-2-3", "url": "https://www.administratorw.com/video.php?url="},
                    {"name": "CK", "type": "1-2-3", "url": "https://www.ckplayer.vip/jiexi/?url="},
					{"name": "B站", "type": "1-2-3", "url": "https://jx.bozrc.com:4433/player/?url="},
                    {"name": "OK", "type": "1-2-3", "url": "https://api.okjx.cc:3389/jx.php?url="},
		            {"name": "OKJX", "type": "1-2-3", "url": "https://okjx.cc/?url="},
                    {"name": "夜幕", "type": "1-2-3", "url": "https://www.yemu.xyz/?url="},
					],
		initCss: () => {
			tool.loadStyle('//at.alicdn.com/t/c/font_3758638_expze4598n7.css');
			tool.loadStyle('//jd.idey.cn/jquery-ui.css');
			let css = `
			::-webkit-scrollbar-thumb {width: 6px;border-radius: 4px; background-color: #54be99; -webkit-transition: all 1s;transition: all 1s;}
			.video-box{position: fixed;top: 55%;left: 0;z-index: 999999996;margin-top: -140px;padding: 0 16px;border-radius: 0 8px 8px 0;background: rgb(134 134 134/40%);box-shadow: 1px 1px 8px 1px rgb(98 99 99 / 34%)}
			.video-box a{position: relative;display: block;box-sizing: border-box;width: 26px;height: 56px;color: #b5b9bc;text-align: center;font-size: 22px;line-height: 20px;}
			.video-box a em{margin: 14px 0;width: 28px;height: 28px;color: #199b6d;font-size: 24px;line-height: 56px;}
			.fontcolor{color:#ccc}
			.video-box a span{display: none;padding: 14px 0;color: #fff;font-size: 12px;line-height: 14px;}
			.ui-dialog{z-index: 9999}
			#dialogs #tabs{float:left;width:345px}
			#dialogs .qcode-box{float:right}
			#dialogs .qcode-box img{max-width: 150px;margin-top:15px;margin-bottom: 30px}
			#dialogs .qcode-box p{text-align:center}
			.tab-ul li{float:left;margin: 0 8px 9px;padding: 6px 1px;width: 74px;border-radius: 4px;text-align: center;font-size: 12px;background: hsla(0,0%,89.8%,.64);cursor:pointer;list-style: none;}
			.tab-ul li:hover{background:#FF5F00;width:76px;color:#54be99}
			.showparse{padding:10px}
			.showparse .tab-ul li{margin:0 4px 5px;padding:5px 6px}
			.ui-widget-header {border:none}
			.showparse p{font-size: 16px;text-align: center;line-height: 40px;font-weight: 900;clear: both;}
			`;
			tool.addStyle(css);
		},
		initEnv: (webfilter) => {
			let node_arr = webfilter.node.split('|');
			for (let i = 0; i < node_arr.length; i++) {
				if ($(node_arr[i]).length) {
					video.player = $(node_arr[i]);
					break;
				}
			}
			video.initHtml();
			video.initEvent()

		},
		initEvent: () => {
			$(".selcheck").on("change", function() {
				if ($(this).is(":checked")) {
					tool.GMsetValue('ISAUTO_VIDEO', 1);
					video.isAuto = 1;
				} else {
					tool.GMsetValue('ISAUTO_VIDEO', 2);
					video.isAuto = 2;
				}
			});
			$(".selplayer").change(function() {
				tool.GMsetValue("ISAUTOPLAYER_VIDEO", $(this).val());
				video.autoPlayer = $(this).val();
				if (video.isAuto == 1) {
					setTimeout(() => {
						window.location.reload();
					}, 200)

				}
			});


			$(".video-set").on("mouseover", function() {
				$(this).children('em').hide();
				$(this).children('span').show();
			});
			$(".video-set").on("mouseout", function() {
				$(this).children('em').show();
				$(this).children('span').hide();
			});
			$("#dialogs").dialog({
				autoOpen: false,
				width: 536,
				buttons: [{
					text: "关闭",
					click: function() {
						$(this).dialog("close");
					}
				}]
			});
			$(".video-set").on("click", function() {
				$("#dialogs").dialog("open");
				event.preventDefault();
			})
			$(".video-parse").on("mouseover", function() {
				$(this).children('em').hide();
				$(this).children('span').show();
			});
			$(".video-parse").on("mouseout", function() {
				$(this).children('em').show();
				$(this).children('span').hide();
			});

			$(".video-parse").on("click", function() {
				$(".showparse").show();
			});
			$(".video-ad").on("mouseover", function() {
				$(this).children('em').hide();
				$(this).children('span').show();
			});
			$(".video-ad").on("mouseout", function() {
				$(this).children('em').show();
				$(this).children('span').hide();
			});
			$(".video-ad").on("click", function() {
				if (video.isCloseAd == 1) {
					tool.GMsetValue('ISCLOSEAD', 2);
					video.isCloseAd = 2;
					$(this).children('em').css('color', '');
					$(this).children('span').html('开启广告');
				} else {
					tool.GMsetValue('ISCLOSEAD', 1);
					video.isCloseAd = 1;
					video.closeAD();
					$(this).children('em').css('color', 'red');
					$(this).children('span').html('去除广告');
				}

			});
			$(".video-box").draggable({
				cursor: "move"
			});
			$(".closefont").on("click", function() {
				$(".showparse").hide();
			});
			$(".tab-ul li").on("click", function() {
				let type = $(this).attr('data-t');
				let link = $(this).attr('data-url') + conf.href;
				$(".showparse").hide();
				$("#dialogs").dialog("close");
				if (type == 1 || type == 3) {
					if (document.getElementById("iframe-player") == null) {
						video.player.empty();
						video.player.append(video.playerParse);
					}

					$("#iframe-player").attr("src", link);

				} else {
					tool.GMopenInTab(link, false);
				}
			})

		},
		autoSelect: () => {
			setInterval(() => {
				try {
					$(".panel-overlay").hide();
					$("#vipPosterContent").remove(); //移除VIP电影收费弹窗
					if (location.href != conf.href) {
						conf.href = location.href;
						window.location.href = location.href;
					}
				} catch (e) {}
			}, 100)
		},
		autoPlayerParse: () => {
			setTimeout(function() {
				if (video.isAuto == 1 && video.autoPlayer != undefined) {
					let link = video.autoPlayer + conf.href;
					if (document.getElementById("iframe-player") == null) {
						video.player.empty();
						video.player.append(video.playerParse);
					}
					$("#iframe-player").attr("src", link);
				}
			}, 3000);
		},
		closeAD: () => {
			if (video.isCloseAd == 1 && video.isAuto != 1) {

				switch (conf.webfilter.name) {
					case 'qq':
						setInterval(() => {
							try {
								let advs = $('.txp_ad').find('txpdiv').find('video');
								advs.each(function(index, vobj) {
									if (vobj.duration !== vobj.currentTime) {
										vobj.setAttribute('src', '');
									}
								})
							} catch (e) {}
						}, 10);
						break;
					case 'mqq':
						setInterval(() => {
							try {
								if ($('.txp_ad')[0] && !$('.txp_ad').hasClass("txp_none")) {
									$('video').each(function(i, vobj) {
										vobj.setAttribute('src', '')
									});
								}
							} catch (e) {}
						}, 50);
						break;
					case 'iqiyi':
						try {
							unsafeWindow.rate = 0;
							unsafeWindow.Date.now = () => {
								return new unsafeWindow.Date().getTime() + (unsafeWindow.rate += 500);
							}
							setInterval(() => {
								unsafeWindow.rate = 0;
							}, 10000);
						} catch (e) {}
						setInterval(() => {
							try {
								if (document.getElementsByClassName("cupid-public-time")[0] !=
									null) {
									$(".skippable-after").css("display", "block");
									document.getElementsByClassName("skippable-after")[0].click();
								}
								$(".qy-player-vippay-popup").css("display", "none");
								$(".black-screen").css("display", "none");
							} catch (e) {}
						}, 500);
						break;
					case 'miqiyi':
						setInterval(() => {
							try {
								if (!$('.normal-public-time').is(":hidden")) {
									$('video').each(function(i, vobj) {
										vobj.currentTime = 888;
									});
								}
							} catch (e) {}
						}, 100);
						break;
					case 'youku':
						window.onload = function() {
							try {
								if (!document.querySelectorAll('video')[0]) {
									setInterval(function() {
										document.querySelectorAll('video')[1].playbackRate = 16;
									}, 100)
								}
							} catch (e) {}
						};
						setInterval(() => {
							try {
								var H5 = $(".h5-ext-layer").find("div")
								if (H5.length != 0) {
									$(".h5-ext-layer div").remove();
									var btn = $(".control-left-grid .control-play-icon");
									if (btn.attr("data-tip") === "播放") {
										$(".h5player-dashboard").css("display", "block");
										btn.click();
										$(".h5player-dashboard").css("display", "none");
									}
								}
								var adv = $('.advertise-layer').find('div').find('video');
								if (adv.length > 0) {
									adv.each(function(index, vobj) {
										if (vobj.duration !== vobj.currentTime) {
											vobj.currentTime = 500;
										}
									})
								}
								if ($(".kui-abortlayer-play-btn").html() === "播 放") {
									$(".kui-abortlayer-play-btn").click();
								}
								$(".information-tips").css("display", "none");
							} catch (e) {}
						}, 50);
						break;
					case 'myouku':
						setInterval(() => {
							try {
								if (!$('.x-advert').is(":hidden")) {
									$('video').each(function(i, vobj) {
										vobj.setAttribute('src', null)
									});
								}
								$(".x-noticeshow").remove();
							} catch (e) {}
						}, 550);
						break;
					case 'sohu':
						setInterval(() => {
							try {
								let vobject = $(".x-video-adv").find('video');
								vobject.each(function(index, vobj) {
									if (vobj.duration != vobj.currentTime) {
										vobj.currentTime = 100;
									}
								})
								$(".x-video-adv").css("display", "none");
								$(".x-player-mask").css("display", "none");
								$("#player_vipTips").css("display", "none");
							} catch (e) {}
						}, 550);
						break;
					case 'msohu':
						setInterval(() => {
							try {
								if (!$('.x-ad-panel').is(":hidden")) {
									$('video').each(function(i, vobj) {
										vobj.playbackRate = 5.5
									});

								}
							} catch (e) {}
						}, 550);
						break;
					case 'mgtv':
						setInterval(() => {
							try {
								if ($('.as_fill_player')[0]) {

									$('video').each(function(i, vobj) {
										vobj.currentTime = 1000;
									});
								}
								$('.as-pause_container').css('display', 'none');
								$('.as_stages-wrapper').css('display', 'none');
								$('.m-agreement').remove();
							} catch (e) {}
						}, 550);
						break;
					case 'mmgtv':
						setInterval(() => {
							try {
								if (!$('.ad-time-area2').is(":hidden")) {
									$('video').each(function(i, vobj) {
										vobj.setAttribute('src', null)
									});

								}
							} catch (e) {}
						}, 550);
						break;
					case 'le':
						setInterval(() => {
							try {
								if ($(".vdo_post_time")[0]) {
									$('video').each(function(i, vobj) {
										vobj.setAttribute('src', null)
									});
								}
							} catch (e) {}
						}, 550);
						break;
					default:
				}
			}

		},
		initHtml: () => {
			let html =
				'<div class="video-box" ><div><a href="javascript:;" class="video-set"  title="解析配置"><em class="iconfont icon-shezhi"></em><span class="">解析设置</span></a><a href="javascript:;"  class="video-parse" ><em class="iconfont icon-bofang"></em><span class="">选择线路</span></a>';
			if (video.isCloseAd == 1) {
				html +=
					'<a href="javascript:;"  class="video-ad" ><em class="iconfont icon-zhongdianguanggaowei" style="color:red"></em><span class="">开启广告</span></a>';
			} else {
				html +=
					'<a href="javascript:;"  class="video-ad" ><em class="iconfont icon-zhongdianguanggaowei"></em><span class="">去除广告</span></a>';
			}
			html +=
				'</div><div class="showparse" style="display:none;width: 395px;z-index: 9999;position: absolute;left: 52px;top: -120px;background:rgb(134 134 134);flex-direction: column;flex:1;"><font class="iconfont  icon-guanbi closefont" style="float: right;cursor: pointer;"></font><div><p>内嵌解析播放</p><ul class="tab-ul">';
			video.playerList.forEach(function(v, i) {
				let type_arr = v.type.split('-');
				type_arr.forEach((d, i) => {
					if (conf.isMobile && d == 3) {
						html += '<li data-url="' + v.url + '" data-t="' + d + '">' + v
							.name + '</li>';
					} else if (!conf.isMobile && d == 1) {
						html += '<li data-url="' + v.url + '" data-t="' + d + '">' + v
							.name + '</li>';
					}

				})
			})
			html += '</ul>';
			if (!conf.isMobile) {
				html += '<p>跳转解析播放</p><ul class="tab-ul">';
				video.playerList.forEach(function(v, i) {
					let type_arr = v.type.split('-');
					type_arr.forEach((d, i) => {
						if (d == 2) {
							html += '<li data-url="' + v.url + '" data-t="' + d + '">' + v
								.name + '</li>';
						}
					})
				})
				html += '</ul>';
			}

			//html+='</div>';
			html += '</div><div id="dialogs"><div id="tabs"><ul><li><a href="#tabs-1">内嵌播放</a></li>';
			if (!conf.isMobile) {
				html += '<li><a href="#tabs-2">跳转播放</a></li>';
			}
			html +=
				'<li><a href="#tabs-3">解析设置</a></li></ul><div id="tabs-1" style="overflow-y:scroll;height:300px;display: inline-block;"><ul class="tab-ul">';
			video.playerList.forEach(function(v, i) {
				let type_arr = v.type.split('-');
				type_arr.forEach((d, i) => {
					if (conf.isMobile && d == 3) {
						html += '<li data-k="' + i + '" data-t="' + d + '">' + v.name +
							'</li>';
					} else if (!conf.isMobile && d == 1) {
						html += '<li data-url="' + v.url + '" data-t="' + d + '">' + v
							.name + '</li>';
					}

				})
			})
			html += '</ul></div>';
			if (!conf.isMobile) {
				html +=
					'<div id="tabs-2" style="overflow-y:scroll;height:300px;display: inline-block;"><ul class="tab-ul">';
				video.playerList.forEach(function(v, i) {
					let type_arr = v.type.split('-');
					type_arr.forEach((d, i) => {
						if (d == 2) {
							html += '<li data-url="' + v.url + '" data-t="' + d + '">' + v
								.name + '</li>';
						}
					})
				})
				html += '</ul></div>';
			}

			html += '<div id="tabs-3"><div><span>自动解析</span>';
			if (video.isAuto == 1) {
				html +=
					'<input class="selcheck" type="checkbox"  style="margin-left:15px;border:1px solid #ccc;width: 22px;height: 20px;-webkit-appearance: auto;" checked/>';
			} else {
				html +=
					'<input class="selcheck" type="checkbox" style="margin-left:15px;border:1px solid #ccc;width: 22px;height: 20px;-webkit-appearance: auto;"/>';
			}
			html +=
				'</div><div><span>解析接口</span><select class="selplayer" style="margin-left:15px;border:1px solid #ccc">';
			video.playerList.forEach(function(v, i) {
				let type_arr = v.type.split('-');
				type_arr.forEach((d, i) => {
					if (conf.isMobile && d == 3) {
						if (video.autoPlayer == v.url) {
							html += '<option selected value="' + v.url + '">' + v.name +
								'</option>'
						} else {
							html += '<option value="' + v.url + '">' + v.name + '</option>'
						}
					}
					if (!conf.isMobile && d == 1) {
						if (video.autoPlayer == v.url) {
							html += '<option selected value="' + v.url + '">' + v.name +
								'</option>'
						} else {
							html += '<option value="' + v.url + '">' + v.name + '</option>'
						}
					}
				})
			})
			html +=
				'</select></div></div></div><div class="qcode-box"><img src="https://jd.idey.cn/wxvideo.jpg"/><p>扫码加关注</p><p>从此不迷路</p></div></div>';

			$("body").append(html);
			$("#tabs").tabs();
		},
	};
	
	const hbcode={
		hosturl:"https://wk.idey.cn",
		initCss:()=>{
			let css=
  			`.gwd_taobao .gwd-minibar-bg, .gwd_tmall .gwd-minibar-bg {
  			    display: block;
  			}

  			.idey-minibar_bg{
  			    position: relative;
  			    min-height: 40px;
  			    display: inline-block;
  			}
  			#idey_minibar{
  			    width: 525px;
  			    background-color: #fff;
  			    position: relative;
  			    border: 1px solid #e8e8e8;
  			    display: block;
  			    line-height: 36px;
  			    font-family: 'Microsoft YaHei',Arial,SimSun!important;
  			    height: 36px;
  			    float: left;
  			}
  			#idey_minibar .idey_website {
  			    width: 48px;
  			    float: left;
  			    height: 36px;
  			}

  			#idey_minibar .minibar-tab {
  			    float: left; height: 36px;border-left: 1px solid #edf1f2!important; padding: 0;margin: 0;text-align: center;
  			}

  			#idey_minibar .idey_website em {
  			    background-position: -10px -28px;
  			    height: 36px;
  			    width: 25px;
  			    float: left;
  			    margin-left: 12px;
  			}

  			.setting-bg {
  			    background: url(https://cdn.gwdang.com/images/extensions/xbt/new_wishlist_pg5_2.png) no-repeat;
  			}

  			#idey_minibar .minibar-tab {
  			    float: left;
  			    height: 36px;
  			    border-left: 1px solid #edf1f2!important;
  			    padding: 0;
  			    margin: 0;
  			    width: 134px;
  			}
  			#idey_price_history span {
  			    float: left;
  			    width: 100%;
  			    text-align: center;
  			    line-height: 36px;
  			    color: #666;
  			    font-size: 14px;
  			}

  			
  			.minibar-btn-box {
  			    display: inline-block;
  			    margin: 0 auto;
  			    float: none;
  			}
  		

  			.collect_mailout_icon {
  			    background-position: -247px -134px;
  			    width: 18px;
  			}

  			#idey_mini_compare_detail li *, .mini-compare-icon, .minibar-btn-box * {
  			    float: left;
  			}
  			.panel-wrap{
  				width: 100%;
  				height: 100%;
  			}
  			.collect_mailout_icon, .mini-compare-icon {
  			    height: 18px;
  			    margin-right: 8px;
  			    margin-top: 9px;
  			}
  			.all-products ul li {
  			    float: left;
  			    width: 138px;
  			    height: 262px;
  			    overflow: hidden;
  			    text-align: center;
  			}
  			.all-products ul li .small-img {
  			    text-align: center;
  			    display: table-cell;
  			    vertical-align: middle;
  			    line-height: 90px;
  			    width: 100%;
  			    height: 100px;
  			    position: relative;
  			    float: left;
  			    margin-top: 23px;
  			}
  			.all-products ul li a img {
  			    vertical-align: middle;
  			    display: inline-block;
  			    width: auto;
  			    height: auto;
  			    max-height: 100px;
  			    max-width: 100px;
  			    float: none;
  			}
  			.all-products ul li a.b2c-other-info {
  			    text-align: center;
  			    float: left;
  			    height: 16px;
  			    line-height: 16px;
  			    margin-top: 13px;
  			}

  			.b2c-other-info .gwd-price {
  			    height: 17px;
  			    line-height: 17px;
  			    font-size: 16px;
  			    color: #E4393C;
  			    font-weight: 700;
  				width: 100%;
  				display: block;
  			}
  			.b2c-other-info .b2c-tle {
  			    height: 38px;
  			    line-height: 19px;
  			    margin-top: 8px;
  			    font-size: 12px;
  			    width: 138px;
  			    margin-left: 29px;
  			}
  			 .bjgext-mini-trend span {
  			      float: left;
  			      /*width: 100%;*/
  			      text-align: center;
  			      line-height: 36px;
  			      color: #666;
  			      font-size: 14px;
  			    }
  			    .bjgext-mini-trend .trend-error-info-mini {
  			      position: absolute;
  			      top: 37px;
  			      left: 0px;
  			      width: 100%;
  			      background: #fff;
  			      z-index: 99999999;
  			      height: 268px;
  			      display: none;
  			      box-shadow: 0px 5px 15px 0 rgba(23,25,27,0.15);
  			      border-radius: 0 0 4px 4px;
  			      width: 460px;
  			      border: 1px solid #ddd;
  			      border-top: none;
  			    }
  			    .bjgext-mini-trend .error-p {
  			      width: 100%;
  			      float: left;
  			      text-align: center;
  			      margin-top: 45px;
  			      font-size: 14px;
  			      color: #666;
  			    }
  			    .bjgext-mini-trend .error-sp {
  			      width: 95px;
  			      margin: 110px auto;
  			      height: 20px;
  			      line-height: 20px;
  			      text-align: center;
  			      color: #000!important;
  			      border: 1px solid #333;
  			      border-radius: 5px;
  			      display: block;
  			      text-decoration: none!important;
  			    }
  			    .bjgext-mini-trend:hover .trend-error-info-mini {
  			      display: block;
  			    }


  			    #coupon_box.coupon-box1 {
  			      width: 525px;
  			      height: 125px;
  			      background-color: #fff;
  			      border: 1px solid #e8e8e8;
  			      border-top: none;
  			      position: relative;
  			      margin: 0px;
  			      padding: 0px;
  			      float: left;
  			      display: block;
  			    }
  			    #coupon_box:after {
  			      display: block;
  			      content: "";
  			      clear: both;
  			    }
  			    .idey_tmall #idey_minibar {
  			      float: none;
  			    }


  			  
  			    .minicoupon_detail img {
  			      width: 114px;
  			      height: 114px;
  			      float: left;
  			      margin-left: 9px;
  			      margin-top: 9px;
  			    }
  			    .minicoupon_detail span {
  			      font-size: 14px;
  			      color: #F95572;
  			      letter-spacing: 0;
  			      font-weight: bold;
  			      float: left;
  			      height: 12px;
  			      line-height: 14px;
  			      width: 100%;
  			      margin-top: 6px;
  			      text-align: center;
  			    }
  			    .coupon-box1 * {
  			      font-family: 'Microsoft YaHei',Arial,SimSun;
  			    }
  			    .coupon-icon {
  			      float: left;
  			      width: 20px;
  			      height: 20px;
  			      background: url('https://cdn.gwdang.com/images/extensions/newbar/coupon_icon.png') 0px 0px no-repeat;
  			      margin: 50px 8px 9px 12px;
  			    }
  			    #coupon_box .coupon-tle {
  			      color: #FF3B5C;font-size: 24px;margin-right: 11px;float: left;height: 114px; overflow: hidden;text-overflow: ellipsis;white-space: nowrap;width: 375px;line-height: 114px;text-decoration: none!important;}
  			    #coupon_box .coupon-row{
  			         color: #FF3B5C;
  			      font-size: 12px;
  			      margin-right: 11px;
  			      float: left;
  			      height: 60px;
  			      overflow: hidden;
  			      text-overflow: ellipsis;
  			      white-space: nowrap;
  			      width: 100%;
  			      line-height: 60px;
  			      text-decoration: none!important;
  			        text-align: center;
  			    }
  			    #coupon_box .coupon-tle * {
  			      color: #f15672;
  			    }
  			    #coupon_box .coupon-tle span {
  			      margin-right: 5px;
  			      font-weight: bold;
  			      font-size: 14px;
  			    }
  			    .coupon_gif {
  			      background: url('https://cdn.gwdang.com/images/extensions/newbar/turn.gif') 0px 0px no-repeat;
  			      float: right;
  			      height: 20px;
  			      width: 56px;
  			      margin-top: 49px;
  			    }
  			    .click2get {
  			      background: url('https://cdn.gwdang.com/images/extensions/newbar/coupon_01.png') 0px 0px no-repeat;
  			      float: left;
  			      height: 30px;
  			      width: 96px;
  			      margin-top: 43px;
  			    }
  			    .click2get span {
  			      height: 24px;
  			      float: left;
  			      margin-left: 1px;
  			    }
  			    .c2g-sp1 {
  			      width: 50px;
  			      color: #FF3B5C;
  			      text-align: center;
  			      font-size: 14px;
  			      line-height: 24px!important;
  			    }
  			    .c2g-sp2 {width: 44px;line-height: 24px!important;color: #fff!important;text-align: center;}
  			    div#idey_wishlist_div.idey_wishlist_div {border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;}
  			    #qrcode{float: left;width: 125px;margin-top:3px;}


  			    .elm_box{
  			        height: 37px; border: 1px solid #ddd;width: 460px;line-height: 37px;margin-bottom: 3px;background-color: #ff0036;font-size: 15px;}
  			    .elm_box span{width:342px;text-align: center; display: block;float: left;color: red;color: white;}
				`
				tool.addStyle(css);
		},
		initHtml:(res,ttype)=>{
			if(ttype=='JD'){
				let html= '<div class="idey-minibar_bg"><div id="idey_minibar" class="alisite_page"><a class="idey_website"  id="idey_website_icon" target="_blank" href="https://www.idey.cn"><em class="setting-bg website_icon"></em></a><div  id="mini_price_history" class="minibar-tab"><span class="blkcolor1">优惠购</span></div><div style="flex: 1" id="idey_mini_remind" class="minibar-tab"> </div></div><div id="promo_box"></div>';
				let data=res.data;
				if(res.type=='success'){
					html +=
							'<a id="coupon_box" title="" class="coupon-box1" href="' + data.couponLink + '">';
						html += '<span class="coupon-icon"></span>';
						html += ' <div class="coupon-tle"> <span>当前商品领券立减' + data.couponAmount +
							'元</span> <em class="coupon_gif"></em></div>';
						html += '<div class="click2get"><span class="c2g-sp1">¥' + data.couponAmount +
							'</span><span class="c2g-sp2">领取</span></div>';
						html += '</a>';
				}else{
					html +=
						'<a id="coupon_box" title="" class="coupon-box1" >';
					html += '<span class="coupon-icon"></span>';
					html += ' <div class="coupon-tle">此商品暂无红包</div>';
	 
					html += '</a>';
				}
				html += '</div>';
				if (data.alist.length > 0) {
					for (let i = 0; i < data.alist.length; i++) {
						html +=
							'<div style="border:1px solid red;line-height:60px;color:red;font-size:20px;text-align:center;width:525px"><a href="' +
							data.alist[i].url + '" target="_blank">' + data.alist[i].name + '</a></div>'
					}
				}
				
				$(conf.webfilter.node).after(html);
				if(data.hbcode!=undefined && data.hbcode !=''){
					let hbm='<div style="position:fixed;width:160px;height:160px;right:28px;bottom:50px;z-index:999"><h1 style="color:red;font-size: 11px">使用京东APP领劵购买此商品</h1><div id="hbcode"></div></div>';
											
					$(".toolbar-qrcode").hide();
					setInterval(function(){
						$(".toolbar-qrcode").hide();
					},100 )
					$("body").append(hbm);
					$("#hbcode").qrcode({
						render: "canvas", //也可以替换为table
						width: 150,
						height: 140,
						text: data.hbcode
					});
				}
			}else if(ttype=='TB'){
				let html= '<div class="idey-minibar_bg"><div id="idey_minibar" class="alisite_page"><a class="idey_website"  id="idey_website_icon" target="_blank" href="https://www.idey.cn"><em class="setting-bg website_icon"></em></a><div  id="mini_price_history" class="minibar-tab"><span class="blkcolor1">优惠购</span></div><div style="flex: 1" id="idey_mini_remind" class="minibar-tab"> </div></div><div id="promo_box"></div>';
				let data=res.data;
				if(res.type=='success'){
					html +=
							'<a id="coupon_box" title="" class="coupon-box1" href="https://www.zbhui.cn/coupon.php?itemurl=' +
						encodeURIComponent(location.href) + '&itemid='+data.itemId+'">';
						html += '<span class="coupon-icon"></span>';
						html += ' <div class="coupon-tle"> <span>当前商品领券立减' + data.couponAmount +
							'元</span> <em class="coupon_gif"></em></div>';
						html += '<div class="click2get"><span class="c2g-sp1">¥' + data.couponAmount +
							'</span><span class="c2g-sp2">领取</span></div>';
						html += '</a>';
				}else{
					html +=
						'<a id="coupon_box" title="" class="coupon-box1" >';
					html += '<span class="coupon-icon"></span>';
					html += ' <div class="coupon-tle">此商品暂无红包</div>';
	 
					html += '</a>';
				}
				html += '</div>';
				if (data.alist.length > 0) {
					for (let i = 0; i < data.alist.length; i++) {
						html +=
							'<div style="border:1px solid red;line-height:60px;color:red;font-size:20px;text-align:center;width:525px"><a href="' +
							data.alist[i].url + '" target="_blank">' + data.alist[i].name + '</a></div>'
					}
				}
				setTimeout(function(){
					let type_arr = conf.webfilter.node.split('|');
					for (let i = 0; i < type_arr.length; i++) {
						if ($(type_arr[i]).length) {
							$(type_arr[i]).after(html);
							break;
						}
					}
				}, 1000 )
				if(data.shortUrl){
					let hbm='<div style="position:fixed;width:170px;height:170px;right:28px;bottom:10px;z-index: 99999999;"><h1 style="color:red;font-size: 11px">使用淘宝APP领劵购买此商品</h1><div id="hbcode"></div></div>';
					$("body").append(hbm);
					$("#hbcode").qrcode({
						render: "canvas", //也可以替换为table
						width: 160,
						height: 150,
						text: data.shortUrl
					});
				}
			}
			
		},
		getSkuid:()=>{
			var params = location.search.split("?")[1].split("&");
			for (var index in params) {
				if (params[index].split("=")[0] == "id") {
					var productId = params[index].split("=")[1];
				}
			}
			return productId;
		},
		onclicks:(link)=>{
			if (document.getElementById('redirect_form')) {
				var form = document.getElementById('redirect_form');
				form.action =hbcode.hosturl+"/red.html?url="+ encodeURIComponent(link);
			} else {
				var form = document.createElement('form');
				form.action = hbcode.hosturl+"/red.html?url="+ encodeURIComponent(link);
				form.target = '_blank';
	 
				form.method = 'POST';
				form.setAttribute("id", 'redirect_form');
				document.body.appendChild(form);
	 
			}
			form.submit();
			form.action = "";
			form.parentNode.removeChild(form);
		},
		querySkuid:()=>{
			
		},
		search:(cp)=>{
			let type_arr = conf.webfilter.node.split('|');
			type_arr.forEach((d, i) => {
					item[num] = [];
					urls[num] = [];
					$(d).each(function(index){
						if ($(this).attr('data-type') != 'yes') {
							var skuid = $(this).attr('data-sku');
							var itemurl = $(this).find('a').attr('href');
							if (itemurl != undefined) {
								if (urls[num].length < 6) {
									item[num].push($(this));
									urls[num].push(itemurl);
									$(this).attr('data-type', 'yes');
								}
							}
						}
					})
					if (urls.length > 0 && urls[num].length > 0 && item[num].length > 0) {
						let u = urls[num].join(',');
						let link=`https://s.idey.cn/jd.php?act=itemlink&itemurl=${u}&num=${num}`;
						tool.get(link,{"referer":location.href}).then((res)=>{
							if (res.type == 'success') {
								for (let p = 0; p < res.data.length; p++) {
									if(cp=='miaosha'){
										item[res.num][p].find("a").attr('data-ref', res.data[p].longUrl);
										item[res.num][p].find("a").attr('target', '');
										item[res.num][p].find("a").attr('href', "javascript:void(0);");
										item[res.num][p].find("a").unbind("click");
									}else{
										item[res.num][p].find("a").attr('data-ref', res.data[p].longUrl);
										item[res.num][p].find("a").attr('target', '');
										item[res.num][p].find("a").removeAttr('onclick');
										item[res.num][p].find("a").unbind("click");
									}
									item[res.num][p].find("a").bind("click", function(e) {
										if($(this).attr('data-ref')) {
											e.preventDefault();
											hbcode.onclicks($(this).attr('data-ref'));
										}
									})
			  
								}
			 
							}
						})
					}
					num += 1;
				});
		}
	}
	conf.webfilter = conf.getWebFilter();
	var num=0,item=[],urls=[];
	if (conf.webfilter != undefined && conf.webfilter.fname == 'video' && conf.isOpenVideo==1) {
		document.addEventListener("DOMContentLoaded", () =>{
			video.initCss();
			video.initEnv(conf.webfilter);
			video.closeAD();

			video.autoPlayerParse();

			video.autoSelect();
		});
	}else if (conf.webfilter != undefined && conf.webfilter.fname == 'hbcode' && conf.isHbCode==1) {
		if(conf.webfilter.name=='jd'){
			hbcode.initCss();
			let productId = /(\d+)\.html/.exec(window.location.href)[1];
			let url="https://tbao.idey.cn/jd.php?act=recovelink&itemurl=" + encodeURIComponent(location.href) +
			'&itemid=' + productId;
			tool.get(url).then((res)=>{
				if (!tool.GetQueryString('utm_campaign') && res.data) {
					window.location.href = hbcode.hosturl+"/red.html?url=" + encodeURIComponent(res.data);
				}	
			})
			url = "https://s.idey.cn/cjd.php?act=item&itemurl=" + encodeURIComponent(location.href) +
			'&itemid=' + productId;
			tool.get(url,{"referer":location.href}).then((res)=>{
				hbcode.initHtml(res,'JD');
			})
		}else if(conf.webfilter.name=='taobao'){
			hbcode.initCss();
			let productId = hbcode.getSkuid();
			let url = "https://s.idey.cn/ltb.php?act=items&itemurl=" + encodeURIComponent(location.href) +
			'&itemid=' +
			productId;
			tool.get(url,{"referer":location.href}).then((res)=>{
				hbcode.initHtml(res,'TB');
			})
		}else if(conf.webfilter.name=='search'){
			document.addEventListener("DOMContentLoaded", () =>{
				setInterval(function(){hbcode.search('search')}, 500);
			});
		}else if(conf.webfilter.name=='miaosha'){
			document.addEventListener("DOMContentLoaded", () =>{
				setInterval(function(){hbcode.search('miaosha')}, 500);


			});
		}
	}
})();