// ==UserScript== // @name 非自动改良版视频解析(适配三端设备) // @namespace https://greasyfork.org/users/1142464 // @version 1.0 // @description 非自动改良版视频解析 // @author mozhu // @match *://*.youku.com/* // @match *://*.iqiyi.com/* // @match *://*.iq.com/* // @match *://*.le.com/* // @match *://v.qq.com/* // @match *://m.v.qq.com/* // @match *://*.tudou.com/* // @match *://*.mgtv.com/* // @match *://tv.sohu.com/* // @match *://*.1905.com/* // @match *://film.sohu.com/* // @match *://*.bilibili.com/* // @match *://*.pptv.com/* // @grant GM_registerMenuCommand // @grant GM_unregisterMenuCommand // @grant GM_setValue // @grant GM_getValue // @grant GM_deleteValue // @grant GM_download // @grant GM_xmlhttpRequest // @grant GM_setClipboard // @connect api.typechrome.com // @connect gitlab.com // @downloadURL https://update.greasyfork.icu/scripts/481608/%E9%9D%9E%E8%87%AA%E5%8A%A8%E6%94%B9%E8%89%AF%E7%89%88%E8%A7%86%E9%A2%91%E8%A7%A3%E6%9E%90%EF%BC%88%E9%80%82%E9%85%8D%E4%B8%89%E7%AB%AF%E8%AE%BE%E5%A4%87%EF%BC%89.user.js // @updateURL https://update.greasyfork.icu/scripts/481608/%E9%9D%9E%E8%87%AA%E5%8A%A8%E6%94%B9%E8%89%AF%E7%89%88%E8%A7%86%E9%A2%91%E8%A7%A3%E6%9E%90%EF%BC%88%E9%80%82%E9%85%8D%E4%B8%89%E7%AB%AF%E8%AE%BE%E5%A4%87%EF%BC%89.meta.js // ==/UserScript== (function() { 'use strict'; var domHead = document.getElementsByTagName('head')[0]; var domStyle = document.createElement('style'); domStyle.type = 'text/css'; domStyle.rel = 'stylesheet'; //平台判断 var isMobile = /Android|webOS|iPhone|iPod|BlackBerry/i.test(navigator.userAgent); if(isMobile){ let playLine = [ {"name":"接口1","url":"https://jx.aidouer.net/?url="}, {"name":"接口2","url":"https://jx.jsonplayer.com/player/?url="}, {"name":"接口3","url":"https://jx.nnxv.cn/tv.php?url="}, {"name":"接口4","url":"https://api.qianqi.net/vip/?url="}, {"name":"接口5","url":"https://jx.playerjy.com/?url="} ]; let useWeb = ['m.bilibili.com','youku.com','www.youku.com','m.youku.com','m.v.qq.com','m.iqiyi.com','m.mgtv.com','m.tv.sohu.com','m.1905.com','m.pptv.com','m.le.com']; if(useWeb.indexOf(location.host) == -1){ console.log('暂不支持');return; } function setCookie(cname,cvalue,exdays){ var d = new Date(); d.setTime(d.getTime()+(exdays*24*60*60*1000)); var expires = "expires="+d.toGMTString(); document.cookie = cname+"="+cvalue+"; "+expires; } function getCookie(cname){ var name = cname + "="; var ca = document.cookie.split(';'); for(var i=0; i${item.name}`; }) playWrapHtml +=""; //template:node;播放区域 let playJxHtml = "
"; playJxHtml += "
"; //循环判断是否在播放页,是则执行下面 let jxVideoData = [ {funcName:"playVideo", node:"#player",match:/m\.v\.qq\.com\/x\/play\.html\?cid=/,areaClassName:'slider_box'}, {funcName:"playVideo", node:"#player",match:/m\.v\.qq\.com\/play\.html\?cid\=/,areaClassName:'slider_box'}, {funcName:"playVideo", node:"#player",match:/m\.v\.qq\.com\/cover\/.*html/,areaClassName:'slider_box'}, {funcName:"playVideo", node:"#player",match:/https?:\/\/m\.v\.qq\.com\/x\/m\/play\?.*cid.*/,areaClassName:'slider_box'}, {funcName:"playVideo", node:".m-video-player-wrap",match:/^https:\/\/m.iqiyi\.com\/[vwa]\_/,areaClassName:'m-sliding-list'}, {funcName:"playVideo", node:".intl-video-wrap",match:/^https:\/\/www\.iq\.com\/play\//,areaClassName:'m-sliding-list'}, {funcName:"playVideo", node:"#player",match:/m\.youku\.com\/alipay_video\/id_/,areaClassName:''}, {funcName:"playVideo", node:"#player",match:/m\.youku\.com\/video\/id_/,areaClassName:''}, {funcName:"playVideo", node:".player-container",nodeType:'class',match:/m\.bilibili\.com\/bangumi/,areaClassName:'ep-list-pre-body'}, {funcName:"playVideo", node:".mplayer",nodeType:'class',match:/m\.bilibili\.com\/video\//,areaClassName:'ep-list-pre-body'}, {funcName:"playVideo", node:".video-area",nodeType:'class',match:/m\.mgtv\.com\/b/,areaClassName:'clearfix'}, {funcName:"playVideo", node:"#le_playbox",nodeType:'id',match:/m\.le\.com\/ptv\/vplay\//,areaClassName:'sideslip_slide'}, {funcName:"playVideo", node:"#j-player",nodeType:'id',match:/m\.le\.com\/vplay/,areaClassName:'juji'}, {funcName:"playVideo", node:"#player",nodeType:'id',match:/play\.tudou\.com\/v_show\/id_/}, {funcName:"playVideo", node:"#pptv_playpage_box",nodeType:'id',match:/v\.pptv\.com\/show\//}, {funcName:"playVideo", node:"#player",nodeType:'id',match:/vip\.1905.com\/play\//}, {funcName:"playVideo", node:"#vodPlayer",nodeType:'id',match:/www\.1905.com\/vod\/play\//}, ]; //创建logo_icon createElement('div','zhmIcon'); let zhmPlay = document.getElementById('zhmIcon'); zhmPlay.innerHTML = playWrapHtml; let jxVideoWeb = jxVideoData.filter(function(item){ return location.href.match(item.match); }) document.querySelector('#zhmlogo').addEventListener('click',function(){ let jxVideoWeb = jxVideoData.filter(function(item){ return location.href.match(item.match); }) if(jxVideoWeb.length == 0){ toast('请在视频播放页点击图标'); }else{ var {funcName,match:nowMatch,node:nowNode,name:nowName} = jxVideoWeb[0]; let playLineDiv = document.querySelector('.zhm_play_video_wrap'); let playShow = playLineDiv.style.display; playShow == 'none'? playLineDiv.style.display = 'block':playLineDiv.style.display = 'none'; var playLineTd = document.querySelectorAll('.playLineTd'); playLineTd.forEach(function(item){ item.addEventListener('click',function(){ playLineTd.forEach(function(e){ e.setAttribute('class','playLineTd zhm_play_video_line_ul_li'); }) this.setAttribute('class','playLineTd zhm_play_video_line_ul_li zhm_line_selected'); setCookie('playLineAction',this.getAttribute('url'),30); let nowWebNode = document.querySelector(nowNode); if(nowWebNode){ nowWebNode.innerHTML = playJxHtml; let playIframe = document.querySelector('#playIframe'); playIframe.src= item.getAttribute('url')+location.href; }else{ console.log('视频不存在'); } }) }) let videoSelect = document.querySelector('.'+jxVideoWeb[0].areaClassName); videoSelect.addEventListener('click',function(e){ setTimeout(function(){ location.href=location.href; },1000) }); return false; } }) let timer = setInterval(function(){ let jxVideoWeb = jxVideoData.filter(function(item){ return location.href.match(item.match); }) if(jxVideoWeb.length>0){ let videoSelect = document.querySelector('.'+jxVideoWeb[0].areaClassName); if(videoSelect){ videoSelect.addEventListener('click',function(e){ setTimeout(function(){ location.href=location.href; },1000) }); } } },1000) } playVideoFunc(); }else{ /*--config--*/ var Config ={ couponUrl:window.location.href, couponHost:window.location.host, webUrl:'http://music.liuzhijin.cn/', iconVipTop:360, iconVipPosition : 'left', iconVipWidth : 40, couponTimerNum : 100,//100次等于10秒 couponWaitTime : 100, iconWaitTime : 100, iconVipOpacity:100, selectedLeft:'selected', selectedRight:'', videoPlayLineAdd:GM_getValue('videoPlayLineAdd',0), } var {couponUrl, couponHost, webUrl, iconVipTop, iconVipPosition, iconVipWidth, iconVipOpacity, couponTimerNum, couponWaitTime, iconWaitTime, selectedLeft, selectedRight, videoPlayLineAdd, } = Config; var jxVideo=[ {funcName:"playVideo",match:/https?:\/\/v\.qq\.com/,name:'qqPC'}, {funcName:"playVideo", match:/https?:\/\/m\.v\.qq\.com/,name:'qqMobile'}, {funcName:"playVideo", match:/^https?:\/\/www\.iqiyi\.com/,name:'iqiyiPc'}, {funcName:"playVideo", match:/^https?:\/\/www\.iq\.com/}, {funcName:"playVideo", node:".m-video-player-wrap",match:/^https?:\/\/m.iqiyi\.com/,areaClassName:'m-sliding-list'}, {funcName:"playVideo", node:"#player",nodeType:'id',match:/m\.youku\.com\/alipay_video\/id_/}, {funcName:"playVideo", node:"#player",nodeType:'id',match:/m\.youku\.com\/video\/id_/}, {funcName:"playVideo", match:/^https?:\/\/.*youku\.com/}, {funcName:"playVideo", match:/^https?:\/\/www\.bilibili\.com/}, {funcName:"playVideo", match:/^https?:\/\/m\.bilibili\.com/}, {funcName:"playVideo", node:".video-area",nodeType:'class',match:/m\.mgtv\.com\/b/}, {funcName:"playVideo", match:/mgtv\.com/,areaClassName:'episode-items clearfix'}, {funcName:"playVideo", node:".x-cover-playbtn-wrap",nodeType:'class',match:/.tv\.sohu\.com/}, {funcName:"playVideo", node:".x-cover-playbtn-wrap",nodeType:'class',match:/m\.tv\.sohu\.com/}, {funcName:"playVideo", node:"#playerWrap",nodeType:'id',match:/film\.sohu\.com/}, {funcName:"playVideo", match:/tudou\.com/}, {funcName:"playVideo",match:/le\.com/}, {funcName:"playVideo",match:/pptv\.com/}, {funcName:"playVideo",match:/1905\.com/}, ]; var playLine = [ {"name":"接口1","url":"https://jx.aidouer.net/?url=","mobile":1}, {"name":"接口2","url":"https://jx.jsonplayer.com/player/?url=","mobile":1}, {"name":"接口3","url":"https://jx.nnxv.cn/tv.php?url=","mobile":1}, {"name":"接口4","url":"https://api.qianqi.net/vip/?url=","mobile":0}, {"name":"接口5","url":"https://jx.playerjy.com/?url=","mobile":0}, ] var keyCode = [ {code:48,isShift:false,value:'0'}, {code:48,isShift:true,value:')'}, {code:49,isShift:false,value:'1'}, {code:49,isShift:true,value:'!'}, {code:50,isShift:false,value:'2'}, {code:50,isShift:true,value:'@'}, {code:51,isShift:false,value:'3'}, {code:51,isShift:true,value:'#'}, {code:52,isShift:false,value:'4'}, {code:52,isShift:true,value:'$'}, {code:53,isShift:false,value:'5'}, {code:53,isShift:true,value:'%'}, {code:54,isShift:false,value:'6'}, {code:54,isShift:true,value:'^'}, {code:55,isShift:false,value:'7'}, {code:55,isShift:true,value:'&'}, {code:56,isShift:false,value:'8'}, {code:56,isShift:true,value:'*'}, {code:57,isShift:false,value:'9'}, {code:57,isShift:true,value:'('}, {code:70,isShift:false,value:'f'}, {code:70,isShift:true,value:'F'}, {code:74,isShift:false,value:'j'}, {code:74,isShift:true,value:'J'}, {code:75,isShift:false,value:'k'}, {code:75,isShift:true,value:'K'}, {code:76,isShift:false,value:'l'}, {code:76,isShift:true,value:'L'}, ] /*--Class--*/ class BaseClass{ constructor(){ if(GM_getValue('iconPositionSetPage') != 0){ /*cookie存储 iconVipTop = this.getCookie('iconTop')?this.getCookie('iconTop'):iconVipTop; iconVipPosition = this.getCookie('iconPosition')?this.getCookie('iconPosition'):iconVipPosition; selectedLeft = iconVipPosition=='left'?'selected':''; selectedRight = iconVipPosition=='right'?'selected':''; iconVipWidth = this.getCookie('iconWidth')?this.getCookie('iconWidth'):iconVipWidth; */ iconVipTop = GM_getValue('iconTop') || GM_getValue('iconTop') == 0?GM_getValue('iconTop'):iconVipTop; iconVipPosition = GM_getValue('iconPosition')?GM_getValue('iconPosition'):iconVipPosition; selectedLeft = iconVipPosition=='left'?'selected':''; selectedRight = iconVipPosition=='right'?'selected':''; iconVipWidth = GM_getValue('iconWidth')?GM_getValue('iconWidth'):iconVipWidth; iconWaitTime = GM_getValue('iconWaitTime')?GM_getValue('iconWaitTime')*1000:iconWaitTime; iconVipOpacity = GM_getValue('iconOpacity') || GM_getValue('iconOpacity') == 0?GM_getValue('iconOpacity'):iconVipOpacity; } GM_registerMenuCommand("设置", () => this.menuSet()); this.setStyle(); } setStyle(){ let menuSetStyle = ` .zhmMask{ z-index:999999999; background-color:#000; position: fixed;top: 0;right: 0;bottom: 0;left: 0; opacity:0.8; } .wrap-box{ z-index:1000000000; position:fixed;;top: 50%;left: 50%;transform: translate(-50%, -200px); width: 300px; color: #555; background-color: #fff; border-radius: 5px; overflow:hidden; font:16px numFont,PingFangSC-Regular,Tahoma,Microsoft Yahei,sans-serif !important; font-weight:400 !important; } .setWrapHead{ background-color:#f24443;height:40px;color:#fff;text-align:center;line-height:40px; } .setWrapLi{ margin:0px;padding:0px; } .setWrapLi li{ background-color: #fff; border-bottom:1px solid #eee; margin:0px !important; padding:12px 20px; display: flex; justify-content: space-between;align-items: center; list-style: none; } .setWrapLiContent{ display: flex;justify-content: space-between;align-items: center; } .setWrapSave{ position:absolute;top:-2px;right:10px;font-size:24px;cursor:pointer } .iconSetFoot{ position:absolute;bottom:0px;padding:10px 20px;width:100%; z-index:1000000009;background:#fef9ef; } .iconSetFootLi{ margin:0px;padding:0px; } .iconSetFootLi li{ display: inline-flex; padding:0px 2px; justify-content: space-between;align-items: center; font-size: 12px; } .iconSetFootLi li a{ color:#555; } .iconSetFootLi a:hover { color:#fe6d73; } .iconSetPage{ z-index:1000000001; position:absolute;top:0px;left:300px; background:#fff; width:300px; height:100%; } .iconSetUlHead{ padding:0px; margin:0px; } .iconSetPageHead{ border-bottom:1px solid #ccc; height:40px; line-height:40px; display: flex; justify-content: space-between; align-items: center; background-color:#fe6d73; color:#fff; font-size: 15px; } .iconSetPageLi{ margin:0px;padding:0px; } .iconSetPageLi li{ list-style: none; padding:8px 20px; border-bottom:1px solid #eee; } .zhihuSetPage{ z-index:1000000002;position:absolute;top:0px;left:300px;background:#fff;width:300px;height:100%; } .iconSetPageInput{ display: flex !important;justify-content: space-between;align-items: center; } .zhihuSetPageLi{ margin:0px;padding:0px; height:258px; overflow-y: scroll; } .zhihuSetPageContent{ display: flex !important;justify-content: space-between;align-items: center; } .zhm_circular{ width: 40px;height: 20px;border-radius: 16px;transition: .3s;cursor: pointer;box-shadow: 0 0 3px #999 inset; } .round-button{ width: 20px;height: 20px;;border-radius: 50%;box-shadow: 0 1px 5px rgba(0,0,0,.5);transition: .3s;position: relative; } .zhm_back{ border: solid #FFF; border-width: 0 3px 3px 0; display: inline-block; padding: 3px;transform: rotate(135deg); -webkit-transform: rotate(135deg);margin-left:10px;cursor:pointer; } .to-right{ margin-left:20px; display: inline-block; padding: 3px;transform: rotate(-45deg); -webkit-transform: rotate(-45deg);cursor:pointer; } .iconSetSave{ font-size:24px;cursor:pointer;margin-right:5px;margin-bottom:4px;color:#FFF; } .zhm_set_page{ z-index:1000000003; position:absolute; top:0px;left:300px; background:#fff; width:300px; height:100%; } .zhm_set_page_header{ border-bottom:1px solid #ccc; height:40px; line-height:40px; display: flex; justify-content: space-between; align-items: center; background-color:#fe6d73; color:#fff; font-size: 15px; } .zhm_set_page_content{ display: flex !important;justify-content: space-between;align-items: center; } .zhm_set_page_list{ margin:0px;padding:0px; height: 220px; overflow-y: scroll; } .zhm_set_page_list::-webkit-scrollbar { /*滚动条整体样式*/ width : 0px; /*高宽分别对应横竖滚动条的尺寸*/ height: 1px; } .zhm_set_page_list::-webkit-scrollbar-thumb { /*滚动条里面小方块*/ border-radius : 2px; background-color: #fe6d73; } .zhm_set_page_list::-webkit-scrollbar-track { /*滚动条里面轨道*/ box-shadow : inset 0 0 5px rgba(0, 0, 0, 0.2); background : #ededed; border-radius: 10px; } .zhm_set_page_list li{ /*border-bottom:1px solid #ccc;*/ padding:12px 20px; display:block; border-bottom:1px solid #eee; } li:last-child{ border-bottom:none; } .zhm_scroll{ overflow-y: scroll !important; } .zhm_scroll::-webkit-scrollbar { /*滚动条整体样式*/ width : 0px; /*高宽分别对应横竖滚动条的尺寸*/ height: 1px; } .zhm_scroll::-webkit-scrollbar-thumb { /*滚动条里面小方块*/ border-radius : 2px; background-color: #fe6d73; } .zhm_scroll::-webkit-scrollbar-track { /*滚动条里面轨道*/ box-shadow : inset 0 0 5px rgba(0, 0, 0, 0.2); background : #ededed; border-radius: 10px; } /*-form-*/ :root { --base-color: #434a56; --white-color-primary: #f7f8f8; --white-color-secondary: #fefefe; --gray-color-primary: #c2c2c2; --gray-color-secondary: #c2c2c2; --gray-color-tertiary: #676f79; --active-color: #227c9d; --valid-color: #c2c2c2; --invalid-color: #f72f47; --invalid-icon: url("data:image/svg+xml;charset=utf8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2224%22%20height%3D%2224%22%20viewBox%3D%220%200%2024%2024%22%3E%20%3Cpath%20d%3D%22M13.41%2012l4.3-4.29a1%201%200%201%200-1.42-1.42L12%2010.59l-4.29-4.3a1%201%200%200%200-1.42%201.42l4.3%204.29-4.3%204.29a1%201%200%200%200%200%201.42%201%201%200%200%200%201.42%200l4.29-4.3%204.29%204.3a1%201%200%200%200%201.42%200%201%201%200%200%200%200-1.42z%22%20fill%3D%22%23f72f47%22%20%2F%3E%3C%2Fsvg%3E"); } .text-input { font-size: 16px; position: relative; right:0px; z-index: 0; } .text-input__body { -webkit-appearance: none; -moz-appearance: none; appearance: none; background-color: transparent; border: 1px solid var(--gray-color-primary); border-radius: 3px; height: 1.7em; line-height: 1.7; overflow: hidden; padding: 2px 1em; text-overflow: ellipsis; transition: background-color 0.3s; width:55%; font-size:14px; box-sizing: initial; } .text-input__body:-ms-input-placeholder { color: var(--gray-color-secondary); } .text-input__body::-moz-placeholder { color: var(--gray-color-secondary); } .text-input__body::placeholder { color: var(--gray-color-secondary); } .text-input__body[data-is-valid] { padding-right: 1em; } .text-input__body[data-is-valid=true] { border-color: var(--valid-color); } .text-input__body[data-is-valid=false] { border-color: var(--invalid-color); box-shadow: inset 0 0 0 1px var(--invalid-color); } .text-input__body:focus { border-color: var(--active-color); box-shadow: inset 0 0 0 1px var(--active-color); outline: none; } .text-input__body:-webkit-autofill { transition-delay: 9999s; -webkit-transition-property: background-color; transition-property: background-color; } .text-input__validator { background-position: right 0.5em center; background-repeat: no-repeat; background-size: 1.5em; display: inline-block; height: 100%; left: 0; position: absolute; top: 0; width: 100%; z-index: -1; } .text-input__body[data-is-valid=false] + .text-input__validator { background-image: var(--invalid-icon); } .select-box { box-sizing: inherit; font-size: 16px; position: relative; transition: background-color 0.5s ease-out; width:90px; } .select-box::after { border-color: var(--gray-color-secondary) transparent transparent transparent; border-style: solid; border-width: 6px 4px 0; bottom: 0; content: ""; display: inline-block; height: 0; margin: auto 0; pointer-events: none; position: absolute; right: -72px; top: 0; width: 0; z-index: 1; } .select-box__body { box-sizing: initial; -webkit-appearance: none; -moz-appearance: none; appearance: none; background-color: transparent; border: 1px solid var(--gray-color-primary); border-radius: 3px; cursor: pointer; height: 1.7em; line-height: 1.7; padding-left: 1em; padding-right: calc(1em + 16px); width: 140%; font-size:14px; padding-top:2px; padding-bottom:2px; } .select-box__body[data-is-valid=true] { border-color: var(--valid-color); box-shadow: inset 0 0 0 1px var(--valid-color); } .select-box__body[data-is-valid=false] { border-color: var(--invalid-color); box-shadow: inset 0 0 0 1px var(--invalid-color); } .select-box__body.focus-visible { border-color: var(--active-color); box-shadow: inset 0 0 0 1px var(--active-color); outline: none; } .select-box__body:-webkit-autofill { transition-delay: 9999s; -webkit-transition-property: background-color; transition-property: background-color; } .textarea__body { -webkit-appearance: none; -moz-appearance: none; appearance: none; background-color: transparent; border: 1px solid var(--gray-color-primary); border-radius: 0; box-sizing: initial; font: inherit; left: 0; letter-spacing: inherit; overflow: hidden; padding: 1em; position: absolute; resize: none; top: 0; transition: background-color 0.5s ease-out; width: 100%; } .textarea__body:only-child { position: relative; resize: vertical; } .textarea__body:focus { border-color: var(--active-color); box-shadow: inset 0 0 0 1px var(--active-color); outline: none; } .textarea__body[data-is-valid=true] { border-color: var(--valid-color); box-shadow: inset 0 0 0 1px var(--valid-color); } .textarea__body[data-is-valid=false] { border-color: var(--invalid-color); box-shadow: inset 0 0 0 1px var(--invalid-color); } .textarea ._dummy-box { border: 1px solid; box-sizing: border-box; min-height: 240px; overflow: hidden; overflow-wrap: break-word; padding: 1em; visibility: hidden; white-space: pre-wrap; word-wrap: break-word; } .toLeftMove{ nimation:moveToLeft 0.5s infinite; -webkit-animation:moveToLeft 0.5s infinite; /*Safari and Chrome*/ animation-iteration-count:1; animation-fill-mode: forwards; } @keyframes moveToLeft{ from {left:200px;} to {left:0px;} } @-webkit-keyframes moveToLeft /*Safari and Chrome*/{ from {left:200px;} to {left:0px;} } .toRightMove{ nimation:moveToRight 2s infinite; -webkit-animation:moveToRight 2s infinite; /*Safari and Chrome*/ animation-iteration-count:1; animation-fill-mode: forwards; } @keyframes moveToRight{ from {left:0px;} to {left:2000px;} } @-webkit-keyframes moveToRight /*Safari and Chrome*/{ from {left:0px;} to {left:200px;} } `; domStyle .appendChild(document.createTextNode(menuSetStyle)); domHead.appendChild(domStyle); } menuSet(){ var setHtml = "
"; setHtml +="
"; setHtml +="
"; setHtml +="
  • "+lang.iconPosition+"×
"; setHtml +="
    "; setHtml +="
  • "+lang.iconHeight+":
  • "; setHtml += "
  • "+lang.iconLine+":
  • " setHtml +="
  • "+lang.iconWidth+":
  • "; setHtml += "
  • "+lang.iconWaitTime+":
  • "; setHtml +="
  • 透 明 度 :
  • "; setHtml +="
"; setHtml +="
"; setHtml +="
  • "+lang.setPlayVideo+"×
"; setHtml +="
    "; let backColor,switchBackCorlor,display; let optionValue = GM_getValue(playVideoOptionJson.optionID,playVideoOptionJson.default); if(optionValue != '22'){ backColor = '#fff'; switchBackCorlor = '#FFF'; }else{ backColor = '#fe6d73'; switchBackCorlor = '#FFE5E5'; } setHtml +="
  • "; setHtml +="
    "; setHtml += ""+playVideoOptionJson.optionName+""; setHtml +="
    "; setHtml +="
    "; setHtml += "
    "; setHtml+="
  • "; setHtml +="
    解析线路
    "; setHtml +="
    "; setHtml +="
    "; setHtml +=""; setHtml +="
  • "; setHtml +="
" setHtml +="
" setHtml +=""; setHtml +=""; setHtml +="
"; setHtml +="
"; setHtml +="'; setHtml +='
'; setHtml += "
"; if(document.querySelector('#setMask')) return; this.createElement('div','zhmMenu'); let zhmMenu = document.getElementById('zhmMenu'); zhmMenu.innerHTML = setHtml; let timerZhmIcon = setInterval(function(){ if (document.querySelector('#zhmMenu')){ clearInterval(timerZhmIcon); // 取消定时器 let circular = document.querySelectorAll('.zhm_circular'); circular.forEach(function(item){ item.addEventListener('click', function(_e){ let buttonStyle = item.children[0].style; let left = buttonStyle.left; left = parseInt(left); let listLeftValue; if(left==0){ buttonStyle.left = '22px'; buttonStyle.background = '#fe6d73'; item.style.background='#ffE5E5'; if(item.nextSibling && item.nextSibling.getAttribute('data')){ item.nextSibling.setAttribute('style','border: solid #ccc;border-width: 0 3px 3px 0;') } listLeftValue = 22; }else{ buttonStyle.left = '0px'; buttonStyle.background = '#fff'; item.style.background='#fff'; if(item.nextSibling){ item.nextSibling.setAttribute('style','border: solid #EEE;border-width: 0 3px 3px 0;') } listLeftValue = 0; } let setListID = item.id; GM_setValue(setListID,listLeftValue); }) }); let toRight = document.querySelectorAll('.to-right'); toRight.forEach(function(item){ item.addEventListener('click', function(e){ let left = item.previousSibling.children[0].style.left; left = parseInt(left); if(left != 22) return; let setPageID = item.getAttribute('data'); let pageId = document.getElementById(setPageID); pageId.className='iconSetPage toLeftMove'; //实时图标高度 if(setPageID == 'movieIconSetPage'){ document.querySelector('#iconTop').value=document.querySelector("#zhmlogo").offsetTop; document.querySelector('#zhmTakePlace').style="height:200px"; } if(setPageID == 'movieVideoSetPage'){ document.querySelector('#zhmTakePlace').style="height:200px"; } console.log(setPageID); }) }) let toBack = document.querySelectorAll('.zhm_back'); toBack.forEach(function(item){ item.addEventListener('click', function(e){ let parentDom = item.parentNode.parentNode.parentNode; parentDom.className='iconSetPage toRightMove'; document.querySelector('#zhmTakePlace').style='height:40px;' }) }) let setSave = document.querySelectorAll('.iconSetSave'); setSave.forEach(function(item){ item.addEventListener('click',()=>{ let iconTop = document.getElementById('iconTop').value; let iconOpacity=document.getElementById('iconOpacity').value; let iconPosition = document.getElementById('iconPosition').value; let iconWidth = document.getElementById('iconWidth').value; let iconWaitTime = document.getElementById('iconWaitTime').value; let playVideoLineText = document.querySelector('#playVideoLineTextarea').value; let playVideoLineLeft = document.querySelector('#videoPlayLineAdd').children[0].style.left; if(iconTop != ''){ if(!(/(^[0-9][0-9]{0,2}$)/.test(iconTop))){ alert(lang.tipErrorIconHeight); return false; } //_this.setCookie('iconTop',iconTop,30); GM_setValue('iconTop',iconTop); } if(iconOpacity != ''){ if(!(/^(?:0|[1-9][0-9]?|100)$/.test(iconOpacity))){ alert(lang.tipErrorIconOpacity); return false; } //_this.setCookie('iconTop',iconTop,30); //alert(iconOpacity);return; GM_setValue('iconOpacity',iconOpacity); } if(iconPosition != ''){ //_this.setCookie('iconPosition',iconPosition,30); GM_setValue('iconPosition',iconPosition); } if(iconWaitTime != ''){ GM_setValue('iconWaitTime',iconWaitTime); } if(iconWidth !=''){ if(!(/(^([1-9][0-9]?)$)/.test(iconWidth))){ alert(lang.tipErrorIconWidth); return false; } //_this.setCookie('iconWidth',iconWidth,30); GM_setValue('iconWidth',iconWidth); } if(GM_getValue('videoPlayLineAdd') == 22){ if(playVideoLineText){ let lineObj = _this.getLine(playVideoLineText); if(lineObj.length>0){ GM_setValue('playVideoLineText',playVideoLineText); }else{ alert('线路输入不正确'); return; } }else{ GM_setValue('playVideoLineText',''); } }else{ GM_setValue('playVideoLineText',playVideoLineText); } history.go(0); }) }) document.getElementById('iconTop').addEventListener('change',function(){ let iconTop = this.value; if(!(/(^[1-9]\d*$)/.test(iconTop))){ this.setAttribute('data-is-valid','false') }else{ this.setAttribute('data-is-valid','true') } return false; }) document.getElementById('iconWidth').addEventListener('change',function(){ let iconWidth = this.value; if(!(/(^[1-9]\d*$)/.test(iconWidth))){ this.setAttribute('data-is-valid','false') }else{ this.setAttribute('data-is-valid','true') } return false; }) //腾讯视频快捷键冲突 if(couponUrl.match(/v\.qq\.com\/x\/cover/)){ let addLineText =document.querySelector('#playVideoLineTextarea'); addLineText.addEventListener('keydown',function(e){ let startPos = addLineText.selectionStart; let endPos = addLineText.selectionEnd; if (startPos === undefined || endPos === undefined) return; keyCode.forEach(function(item){ if(e.keyCode == item.code && e.shiftKey==item.isShift){ let textValue = addLineText.value; let startValue = textValue.substring(0,startPos); let endValue = textValue.substring(startPos); let allValue = startValue+item.value+endValue; addLineText.value=allValue; addLineText.selectionStart = startPos+1; addLineText.selectionEnd = endPos+1; } }) }) } } }) } createElement(dom,domId){ var rootElement = document.body; var newElement = document.createElement(dom); newElement.id = domId; var newElementHtmlContent = document.createTextNode(''); rootElement.appendChild(newElement); newElement.appendChild(newElementHtmlContent); } request(method,url,data,isCookie=''){ let request = new XMLHttpRequest(); return new Promise((resolve,reject)=>{ request.onreadystatechange=function(){ if(request.readyState==4){ if(request.status==200){ resolve(request.responseText); }else{ reject(request.status); } } } request.open(method,url); //request.withCredentials = true; if(isCookie){ request.withCredentials = true; } request.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); request.send(data); }) } setCookie(cname,cvalue,exdays){ var d = new Date(); d.setTime(d.getTime()+(exdays*24*60*60*1000)); var expires = "expires="+d.toGMTString(); document.cookie = cname+"="+cvalue+"; "+expires; } getCookie(cname){ var name = cname + "="; var ca = document.cookie.split(';'); for(var i=0; i{obj[$1]=$2}); return obj; } getLine(text){ let textArr = text.split('\n'); if(textArr.length > 0){ let lineObj = []; let match = /^(.+)(https?:\/\/.+)$/; textArr.forEach(function(item){ item = item.replace(/\s*,*/g,''); if(!item) return true; let lineMatch = item.match(match); if(lineMatch){ lineObj.push({'name':lineMatch[1].substring(0,4),'url':lineMatch[2]}); }else{ lineObj=[]; return false; } }) return lineObj; } } //all参数默认空,是真时返回为数组 static getElement(css,all=''){ return new Promise((resolve,reject)=>{ let num = 0; let timer = setInterval(function(){ num++ let dom; if(all == false){ dom = document.querySelector(css); if(dom){ clearInterval(timer); resolve(dom); } }else{ dom = document.querySelectorAll(css); if(dom.length>0){ clearInterval(timer); resolve(dom); } } if(num==20){ clearInterval(timer); resolve(false); } },300) }) } static toast(msg,duration){ duration=isNaN(duration)?3000:duration; let toastDom = document.createElement('div'); toastDom.innerHTML = msg; //toastDom.style.cssText="width: 60%;min-width: 150px;opacity: 0.7;height: 30px;color: rgb(255, 255, 255);line-height: 30px;text-align: center;border-radius: 5px;position: fixed;top: 40%;left: 20%;z-index: 999999;background: rgb(0, 0, 0);font-size: 12px;"; toastDom.style.cssText='padding:2px 15px;min-height: 36px;line-height: 36px;text-align: center;transform: translate(-50%);border-radius: 4px;color: rgb(255, 255, 255);position: fixed;top: 50%;left: 50%;z-index: 9999999;background: rgb(0, 0, 0);font-size: 16px;' document.body.appendChild(toastDom); setTimeout(function() { var d = 0.5; toastDom.style.webkitTransition = '-webkit-transform ' + d + 's ease-in, opacity ' + d + 's ease-in'; toastDom.style.opacity = '0'; setTimeout(function() { document.body.removeChild(toastDom) }, d * 1000); }, duration); } //create zhmLogoIcon zhmLogo(){ var _this = this; let sortDiv = iconVipPosition=='left'?'row':'row-reverse'; let playVideoStyle = ` .zhm_play_vidoe_icon { padding-top: 2px; cursor: pointer; z-index: 999999; position: fixed; ${iconVipPosition}: 5px; top: ${iconVipTop}px; text-align: center; overflow: visible; display: flex; flex-direction: ${sortDiv}; width: auto; } .zhm_play_video_wrap { z-index: 9999999; overflow: hidden; width: 300px; } .iconLogo { opacity: ${iconVipOpacity / 100}; } .zhm_play_video_line { width: 320px; height: 316px; overflow-y: scroll; overflow-x: hidden; } .zhm_play_video_line_ul { width: 300px; display: flex; justify-content: flex-start; flex-flow: row wrap; list-style: none; padding: 0px; margin: 0px; } .zhm_play_video_line_ul_li { padding: 4px 0px; margin: 2px; width: 30%; color: #FFF; text-align: center; background-color: #3498db; /* 将原来的颜色 #f24443 替换为新颜色 #3498db */ box-shadow: 0px 0px 10px #fff; font-size: 14px; } .zhm_play_video_line_ul_li:hover { color: #260033; background-color: #aed6f1; /* 将原来的颜色 #fcc0c0 替换为新颜色 #aed6f1 */ } .zhm_line_selected { color: #260033; background-color: #aed6f1; /* 将原来的颜色 #fcc0c0 替换为新颜色 #aed6f1 */ } .zhm_play_video_jx { width: 100%; height: 100%; z-index: 999999; position: absolute; top: 0px; padding: 0px; } `; domStyle .appendChild(document.createTextNode(playVideoStyle)); domHead.appendChild(domStyle); let playWrapHtml = "