mirror of
https://github.com/the1812/Bilibili-Evolved.git
synced 2025-11-04 21:22:45 +08:00
1 line
1.0 KiB
JavaScript
1 line
1.0 KiB
JavaScript
(()=>{return(e,i)=>{const n=`www.biliplus.com`;const c=["bilibili.com/video/","bilibili.com/bangumi/play","space.bilibili.com"];return{widget:{condition:()=>{return c.some(e=>document.URL.includes(e))},content:`\n<a class="gui-settings-flat-button" id="biliplus-redirect">\n<i class="icon-biliplus"></i>\n<span>转到BiliPlus</span>\n</a>`,success:()=>{const e=document.querySelector("#biliplus-redirect");const i=/\/video\/(av[\d]+|BV.+)/i;const c=()=>{e.href="";e.disabled=true};const o=i=>{if(document.URL!==i){e.href=i}else{c()}};if(location.host==="space.bilibili.com"){const e=document.URL.replace("space.bilibili.com/",`${n}/space/`);o(e)}else if(document.URL.includes("/bangumi/play")){Observer.videoChange(()=>{const e=document.querySelector(".av-link,.info-sec-av");const i=unsafeWindow.aid||e.innerText.replace(/[aAvV]/g,"");const c=`https://${n}/video/av${i}/`;o(c)})}else if(i.test(document.URL)){const[,e]=document.URL.match(i);o(`https://${n}/video/${e}/`)}else{Observer.videoChange(()=>{const e=document.URL.replace(window.location.host,n);o(e)})}}}}}})(); |