Merge pull request #666 from the1812/preview

Hotfix #3 for v1.10.29
This commit is contained in:
Grant Howard 2020-06-27 16:29:07 +08:00 committed by GitHub
commit 9310918417
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 50 additions and 47 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -33,7 +33,7 @@
"compact-layout.min.js": "B20609A7CBBDB1845FA0156FB5BE6B1E1A1B8B069EA85F65D16241DD2C12D738",
"custom-control-background.min.css": "1981FD2BF3B17ECF33F98D5DEDAF0D32ACBE9532A51FDB70822286991AB98EF3",
"custom-control-background.min.js": "B9F366B251D1572ACE801FF6ECF15D4D1AAB3EA5A5B04B961B6F4310E2AB1A84",
"custom-navbar.min.css": "8EB07A467F5B63B0BDBF12B82D0E025E23A1D9FCE999983D937B29215085707C",
"custom-navbar.min.css": "E203AC951B2D5B3C81061E3C90D748C6F6E3453DB25EE376E495E3AB6A115C81",
"custom-navbar.min.html": "183B1F7182633044CCB20A3710524492118308CF55915AA9AA9F36850500F457",
"custom-navbar.min.js": "36416168F37791651C0533EDE4348A510A3160443DFA0BFD332BB9685EF52CA7",
"custom-navbar-activities.min.js": "23CED08D224447A793F8B85433EFACA2C151034A025EB9D3B427101C2AFD16AF",
@ -199,7 +199,7 @@
"settings-tooltip.min.js": "E9ABA72B3C29CA850342109E57B055B193F3356DD59876B202E8E908AE6247C9",
"settings-tooltip.zh-CN.min.js": "C237FB86DE05C28C1EB8A11EAE85D4F79D942937C6DD8BD2D4D900FCC99B930B",
"show-cover-before-play.min.css": "E963B5E47F0FF5F283CE2C2621DF7AD13A97C619386F2807021E57544233B08F",
"show-cover-before-play.min.js": "F79505D3C068F7B2D71DD1F2A4AB5F35CDC9ABEFE17BBEA6844461CC429B7CE5",
"show-cover-before-play.min.js": "7CB9F6D6F4F0C6DF2D5D251306314D055C53FF9992C4DDB6E5A6A2B2F22A641A",
"show-dead-video-title.min.js": "8D591930421EBA43A1BDF50DC8B645C1BD1A17E109FB1CFBCD6B78E6C74E1D68",
"simple-home.vue.min.js": "1F5CF46DEE65549A30C5F0790578EED0C6B3AD6C5F20D9B88CD745C4B7664ABB",
"simple-home-bangumi-category.vue.min.js": "87DCA2C8295CAD66C9FA01D65437EC2F9DD5E7F4A565B4384ABAB1746A6787EE",
@ -242,7 +242,7 @@
"video-list.vue.min.js": "90C4CCAB3C9C3FB0CFE39C9A9482C3A964EE7FAC17F7FBF682CCC2FEFB6632F2",
"video-story.min.js": "F9D4D2D80997DF5F11BF0CFA4D389B77BDBF1566EA6002E47174B68B440F3C0D",
"view-cover.min.js": "895AA8A393D5EBA787ABCAE12EAF4D47E5A68E6B998E4FE839F81FB491F92ED5",
"watchlater.min.js": "E8B9C8F7B435ABC9D6E3D73B6E73E4518C1DC44B1CDED48964A28121766548A9",
"watchlater.min.js": "940646B8DEAC0B2C47BACD360A259DFCF9F67F78E4B9D38ACE9E8D7322E88016",
"watchlater-api.min.js": "0A341429EFB4489594C6670A1FEEF99E7EC2564FF18BCE3A679E98101BA0F2F4",
"watchlater-expire-warnings.min.js": "99282802EF8EB87F199BDE88240E1F196CD85C77516E8D5466EB6F1939B908DD"
}

Binary file not shown.

File diff suppressed because one or more lines are too long

View File

@ -1 +1 @@
(()=>{return(e,n)=>{const o={include:["//www.bilibili.com/video/","//www.bilibili.com/bangumi/"]};const i="showCoverBeforePlayStyle";let t;const r=()=>{const e=async()=>{if(o.include.every(e=>!document.URL.includes(e))){return}const e=()=>document.body.style.removeProperty("--cover-url");n.applyStyle(i);const r=await SpinQuery.select(()=>unsafeWindow.aid);if(!r){console.warn("[播放前显示封面] 未找到av号");e();return}const{cid:c}=unsafeWindow;if(c===t||!c){e();return}t=c;const l=await SpinQuery.select("video");if(!l){console.warn("[播放前显示封面] 未找到视频");e();return}const{VideoInfo:s}=await n.importAsync("video-info");const u=new s(r);await u.fetchInfo();if(!l.paused){e();return}document.body.style.setProperty("--cover-url",`url('${u.coverUrl}')`);l.addEventListener("play",()=>{e()},{once:true})};if(document.URL.includes("//www.bilibili.com/bangumi/")){Observer.videoChange(e)}else{e()}};r();return{reload:()=>n.applyStyle(i),unload:()=>n.removeStyle(i)}}})();
(()=>{return(e,o)=>{const n={include:["//www.bilibili.com/video/","//www.bilibili.com/bangumi/"]};const t="showCoverBeforePlayStyle";let i;const r=()=>{const e=async()=>{if(n.include.every(e=>!document.URL.includes(e))){return}const e=()=>document.body.style.removeProperty("--cover-url");const r=HTMLVideoElement.prototype.play;HTMLVideoElement.prototype.play=function(...o){e();return r.call(this,...o)};o.applyStyle(t);const l=await SpinQuery.select(()=>unsafeWindow.aid);if(!l){console.warn("[播放前显示封面] 未找到av号");return}const{cid:c}=unsafeWindow;if(c===i||!c){return}i=c;const{VideoInfo:s}=await o.importAsync("video-info");const u=new s(l);await u.fetchInfo();if(!dq("video").paused){return}document.body.style.setProperty("--cover-url",`url('${u.coverUrl}')`)};if(document.URL.includes("//www.bilibili.com/bangumi/")){Observer.videoChange(e)}else{e()}};r();return{reload:()=>o.applyStyle(t),unload:()=>o.removeStyle(t)}}})();

View File

@ -1 +1 @@
(()=>{return(e,t)=>{const i=e=>{const t=e.match(/(BV[\w]+)\/p([\d]+)/i)||e.match(/(av[\d]+)\/p([\d]+)/i);if(t){return`https://www.bilibili.com/video/${t[1]}/?p=${t[2]}`}else{return"javascript:;"}};const r=e=>{const t=e.map(e=>{const t=e.getAttribute("href");if(!t){return"javascript:;"}if(t.match(/.*watchlater.*|javascript:;/g)){return i(t)}if(t.match(/video\/av|video\/BV/i)){return t}return t});e.forEach((e,i)=>{e.setAttribute("href",t[i]);e.setAttribute("target","_blank")})};const a=(...e)=>{for(const t of e){SpinQuery.select(()=>document.querySelectorAll(t),e=>r([...e]))}};if(e.watchLaterRedirectPage){SpinQuery.select(".watch-later-list").then(()=>{Observer.childListSubtree("#viewlater-app",()=>{SpinQuery.condition(()=>document.URL.match(/(av[\d]+)\/p([\d]+)/i)||document.URL.match(/(BV[\w]+)\/p([\d]+)/i),e=>e!==null&&document.URL.indexOf("watchlater")!==-1,()=>{const e=i(document.URL);if(e!==null){window.location.assign(e)}});SpinQuery.select("#viewlater-app .s-btn[href='#/']",e=>e.remove());a(".av-pic",".av-about>a")})})}if(e.watchLaterRedirectNavbar){SpinQuery.select("li.nav-item[report-id*=watchlater]").then(()=>{Observer.childListSubtree("li.nav-item[report-id*=watchlater]",()=>{a(".av-item>a",".av-about>a","div.watch-later-m>ul>div>li>a");SpinQuery.select(".read-more.mr",e=>e.remove());SpinQuery.select(".read-more-grp>.read-more",e=>{e.style.width="auto";e.style.float="none"})})});SpinQuery.select(".van-popper-favorite").then(async e=>{if(!e){return}const t=Observer.childListSubtree(e,()=>{const i=e.querySelector(".play-all");if(i){const e="//www.bilibili.com/watchlater/#/list";Observer.attributes(i,()=>{if(i.firstElementChild===null||i.lastChild===null){return}if(i.getAttribute("href")==="//www.bilibili.com/watchlater/"){i.setAttribute("href",e);i.firstElementChild.classList.remove("bili-icon_dingdao_bofang");i.firstElementChild.classList.add("bili-icon_xinxi_yuedushu");i.lastChild.nodeValue="查看全部"}else if(i.getAttribute("href")!==e){i.firstElementChild.classList.add("bili-icon_dingdao_bofang");i.firstElementChild.classList.remove("bili-icon_xinxi_yuedushu");i.lastChild.nodeValue="播放全部"}});t.forEach(e=>e.stop())}})})}}})();
(()=>{return(t,e)=>{const i=t=>{const e=t.match(/(BV[\w]+)\/p([\d]+)/i)||t.match(/(av[\d]+)\/p([\d]+)/i);if(e){return`https://www.bilibili.com/video/${e[1]}/?p=${e[2]}`}else{return"javascript:;"}};const r=t=>{const e=t.map(t=>{const e=t.getAttribute("href");if(!e){return"javascript:;"}if(e.match(/.*watchlater.*|javascript:;/g)){return i(e)}if(e.match(/video\/av|video\/BV/i)){return e}return e});t.forEach((t,i)=>{t.setAttribute("href",e[i]);t.setAttribute("target","_blank")})};const a=(...t)=>{for(const e of t){SpinQuery.select(()=>document.querySelectorAll(e),t=>r([...t]))}};if(t.watchLaterRedirectPage){SpinQuery.select(".watch-later-list").then(()=>{a(".av-pic",".av-about>a")})}if(t.watchLaterRedirectNavbar){SpinQuery.select("li.nav-item[report-id*=watchlater]").then(()=>{Observer.childListSubtree("li.nav-item[report-id*=watchlater]",()=>{a(".av-item>a",".av-about>a","div.watch-later-m>ul>div>li>a");SpinQuery.select(".read-more.mr",t=>t.remove());SpinQuery.select(".read-more-grp>.read-more",t=>{t.style.width="auto";t.style.float="none"})})});SpinQuery.select(".van-popper-favorite").then(async t=>{if(!t){return}const e=Observer.childListSubtree(t,()=>{const i=t.querySelector(".play-all");if(i){const t="//www.bilibili.com/watchlater/#/list";Observer.attributes(i,()=>{if(i.firstElementChild===null||i.lastChild===null){return}if(i.getAttribute("href")==="//www.bilibili.com/watchlater/"){i.setAttribute("href",t);i.firstElementChild.classList.remove("bili-icon_dingdao_bofang");i.firstElementChild.classList.add("bili-icon_xinxi_yuedushu");i.lastChild.nodeValue="查看全部"}else if(i.getAttribute("href")!==t){i.firstElementChild.classList.add("bili-icon_dingdao_bofang");i.firstElementChild.classList.remove("bili-icon_xinxi_yuedushu");i.lastChild.nodeValue="播放全部"}});e.forEach(t=>t.stop())}})})}}})();

View File

@ -244,6 +244,7 @@ li.nav-item[report-id="playpage_dynamic"] .i-frame,
width: 100%;
height: calc(2 * var(--navbar-height));
background-image: linear-gradient(to bottom, #000a 0, #0004 65%, transparent 100%);
pointer-events: none;
}
}
.popup {

View File

@ -37,20 +37,20 @@ const redirectSelectors = (...selectors: string[]) => {
if (settings.watchLaterRedirectPage) {
// 稍后再看列表
SpinQuery.select('.watch-later-list').then(() => {
Observer.childListSubtree('#viewlater-app', () => {
SpinQuery.condition(
() => document.URL.match(/(av[\d]+)\/p([\d]+)/i) || document.URL.match(/(BV[\w]+)\/p([\d]+)/i),
it => it !== null && document.URL.indexOf('watchlater') !== -1,
() => {
const url = getRedirectLink(document.URL)
if (url !== null) {
window.location.assign(url)
}
}
)
SpinQuery.select("#viewlater-app .s-btn[href='#/']", it => it.remove())
// Observer.childListSubtree('#viewlater-app', () => {
// SpinQuery.condition(
// () => document.URL.match(/(av[\d]+)\/p([\d]+)/i) || document.URL.match(/(BV[\w]+)\/p([\d]+)/i),
// it => it !== null && document.URL.indexOf('watchlater') !== -1,
// () => {
// const url = getRedirectLink(document.URL)
// if (url !== null) {
// window.location.assign(url)
// }
// }
// )
// SpinQuery.select("#viewlater-app .s-btn[href='#/']", it => it.remove())
redirectSelectors('.av-pic', '.av-about>a')
})
// })
})
}
if (settings.watchLaterRedirectNavbar) {

View File

@ -12,36 +12,38 @@ const entry = () => {
return
}
const removeCover = () => document.body.style.removeProperty('--cover-url')
const originalPlay = HTMLVideoElement.prototype.play
HTMLVideoElement.prototype.play = function (...args: any[]) {
removeCover()
return originalPlay.call(this, ...args)
}
resources.applyStyle(styleID)
const aid = await SpinQuery.select(() => unsafeWindow.aid)
if (!aid) {
console.warn('[播放前显示封面] 未找到av号')
removeCover()
return
}
const { cid } = unsafeWindow
if (cid === lastCid || !cid) {
removeCover()
return
}
lastCid = cid
const video = await SpinQuery.select('video') as HTMLVideoElement
if (!video) {
console.warn('[播放前显示封面] 未找到视频')
removeCover()
return
}
// const video = await SpinQuery.select('video') as HTMLVideoElement
// if (!video) {
// console.warn('[播放前显示封面] 未找到视频')
// return
// }
const { VideoInfo } = await import('../video-info')
const info = new VideoInfo(aid)
await info.fetchInfo()
if (!video.paused) {
removeCover()
if (!(dq('video') as HTMLVideoElement).paused) {
return
}
document.body.style.setProperty('--cover-url', `url('${info.coverUrl}')`)
video.addEventListener('play', () => {
removeCover()
}, { once: true })
// video.addEventListener('play', () => {
// removeCover()
// }, { once: true })
// unsafeWindow.trackingVideo = video
}
// Observer.videoChange(showCover)
if (document.URL.includes('//www.bilibili.com/bangumi/')) {