Bilibili-Evolved/min/watchlater.min.js
2019-01-23 23:57:20 +08:00

1 line
1.2 KiB
JavaScript

(()=>{return()=>{const e=e=>{const t=e.match(/(av[\d]+)\/p([\d]+)/);if(t){return`https://www.bilibili.com/video/${t[1]}/?p=${t[2]}`}else{return"javascript:;"}};const t=t=>{const r=t.map(t=>{const r=t.getAttribute("href");if(!r){return"javascript:;"}if(r.match(/.*watchlater.*|javascript:;/g)){return e(r)}if(r.indexOf("video/av")!==-1){return r}});t.forEach((e,t)=>$(e).attr("href",r[t]).attr("target","_blank"))};const r=(...e)=>{for(const r of e){SpinQuery.select(()=>document.querySelectorAll(r),e=>t([...e]))}};SpinQuery.any(()=>$(".watch-later-list"),()=>{(Observer.childListSubtree||Observer.subtree)("#viewlater-app",()=>{SpinQuery.condition(()=>document.URL.match(/(av[\d]+)\/p([\d]+)/),e=>e&&document.URL.indexOf("watchlater")!==-1,()=>{const t=e(document.URL);if(t!==null){window.location.replace(t)}});SpinQuery.any(()=>$("#viewlater-app .s-btn[href='#/']"),e=>e.remove());r(".av-pic",".av-about>a")})});SpinQuery.any(()=>$("li.nav-item[report-id*=watchlater]"),()=>{(Observer.childListSubtree||Observer.subtree)("li.nav-item[report-id*=watchlater]",()=>{r(".av-item>a",".av-about>a","div.watch-later-m>ul>div>li>a");SpinQuery.any(()=>$(".read-more.mr"),e=>e.remove());SpinQuery.any(()=>$(".read-more-grp>.read-more"),e=>e.css({float:"none",width:"auto"}))})})}})();