var dp,clickVideoStatus=!1;let btn=document.querySelector(".box .left .label");function addHistoryVideo(t,n){var e;localStorage.getItem("nikename")&&(e=location.pathname.split("/").pop().split(".")[0],getFetch(`/plugin/video/resource/status?id=${e}&type=${t}&status=`+n).then(e=>{3===t&&n?(alert("\u6536\u85cf\u6210\u529f\uff01"),btn.setAttribute("type","cav"),btn.innerHTML='<i class="i-icon i-heart-filled"></i>\u53d6\u6d88'):3!==t||n||(alert("\u5df2\u53d6\u6d88\u6536\u85cf\uff01"),btn.setAttribute("type","fav"),btn.innerHTML='<i class="i-icon i-heart"></i>\u6536\u85cf')}))}function loadDPVideo(){var e=document.getElementById("dplayers").getAttribute("vurl");(dp=new Aliplayer({id:"dplayers",source:e,width:"100%",height:"100%",autoplay:!1,isLive:!1,rePlay:!1,playsinline:!0,preload:!0,useH5Prism:!0,controlBarVisibility:"click",diagnosisButtonVisible:!1,vodRetry:20,rtsLoadDataTimeout:12e3,x5_type:"h5",skinLayout:[{name:"bigPlayButton",align:"blabs",x:10,y:60},{name:"controlBar",align:"blabs",x:0,y:0,children:[{name:"progress",align:"blabs",x:0,y:44},{name:"playButton",align:"tl",x:15,y:12},{name:"timeDisplay",align:"tl",x:10,y:7},{name:"fullScreenButton",align:"tr",x:10,y:12},{name:"volume",align:"tr",x:5,y:10}]}]})).on("ready",e=>{document.querySelector(".blur_box .loading").remove(),console.log("\u89c6\u9891\u52a0\u8f7d\u5b8c\u6210")}),dp.on("play",()=>{var e,t=dp.getDuration();let n=document.querySelector(".blur_box .tips");console.log("\u70b9\u51fb\u64ad\u653e"),setTimeout(function(){n.style.bottom="-2.2rem"},3e3),2<t&&t<=180&&t%1!=0&&(e=document.querySelector(".main_domain .forever span").textContent,getFeedback(e,`该视频总时常小于3分钟:${t}s`)),clickVideoStatus?document.querySelector(".blur_box .push")&&document.querySelector(".blur_box .push").remove():getPlayImg()}),dp.on("pause",()=>{console.log("\u70b9\u51fb\u6682\u505c"),clickVideoStatus&&getPusImg()}),testVideoUrl()}async function getPusImg(){var e=await getFastBannerItem("videoPusImg"),t=document.querySelector(".blur_box"),e=getRandomObjects(e,1);t&&0<e.length?(dp.pause(),e=`<div class="push"><a link="${e[0].links}" cid="${e[0].id}" class="ulink"><img src="${e[0].pic}" loading="lazy" /></a></div>`,t.insertAdjacentHTML("beforeend",e),clickFastTap()):document.querySelector(".blur_box .push").remove()}async function getPlayImg(){var e=await getFastBannerItem("videoPlyImg"),t=document.querySelector(".blur_box"),e=getRandomObjects(e,1);t&&0<e.length&&(dp.pause(),e=`<div class="start" style="background-image: url(${e[0].pic});"><span>8秒</span><a link="${e[0].links}" cid="${e[0].id}" class="ulink"><img src="${e[0].pic}" loading="lazy" /></a></div>`,t.insertAdjacentHTML("beforeend",e),clickFastTap(),updateCountdown())}async function getFastBtmImg(){var e=await getFastBannerItem("videoBtmImg"),t=document.querySelector(".vaj_list .btm"),e=getRandomObjects(e,1);t&&0<e.length&&(t.innerHTML=`<a link="${e[0].links}" cid="${e[0].id}" style="background-image:url(${e[0].pic})" class="img ulink"><img src="${e[0].pic}" loading="lazy"/></a>`,clickFastTap())}function updateCountdown(){let e=8,t=()=>{0<(self.countdown=e)?(e--,document.querySelector(".blur_box .start span").textContent=e+"\u79d2",setTimeout(t,1e3)):(dp.play(),document.querySelector(".blur_box .start").remove(),clickVideoStatus=!0)};t()}function testVideoUrl(){let n=0,a="";timestamp=(new Date).getTime();let o=[{link:document.getElementById("dplayers").getAttribute("vpic"),type:"image",name:"\u56fe\u7247"},{link:document.getElementById("dplayers").getAttribute("vurl"),type:"application",name:"M3U8"}],i=async()=>{let t=o[n];var e=new URLSearchParams;e.append("url",t.link),console.log("\u5f00\u59cb\u81ea\u68c0"+t.name),await fetch("https://status.bdscdnstatic.com",{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:e}).then(e=>e.json()).then(e=>{"number"==typeof e.status&&0!=e.status&&200!=e.status&&(a+=`[${t.name}]${t.link} 打开异常:${e.msg},`)}),++n<o.length?i():a&&(e=document.querySelector(".main_domain .forever span").textContent,getFeedback(e,a))};i()}btn&&(btn.addEventListener("click",function(e){var t=localStorage.getItem("nikename"),n=btn.getAttribute("type");t?addHistoryVideo(3,"fav"===n):openPopShowTap()}),loadDPVideo(),addHistoryVideo(1,!0)),getFastBtmImg();