Merge pull request #660 from the1812/preview

Hotfix #1 for v1.10.29
This commit is contained in:
Grant Howard 2020-06-26 10:06:20 +08:00 committed by GitHub
commit 4bf63e7d57
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 25 additions and 20 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

@ -58,12 +58,11 @@
"danmaku-send-bar.min.css": "52149D46CF3A15CF6EB186CB49F298DE18B0723E52D8693228F66099847EDCCB",
"danmaku-send-bar.min.js": "7108E72F00C169F26E20409F4AA79F05553310375BABC392EB7E2166224B800A",
"dark.min.css": "978F6C3E9E63568E38B4A9F2983FD580C96AD3D90CACFCCC24D7FB78D5132D98",
"dark.user.css": "3BA5282CBEC7233FB282D422C3F582B8E263BA774C6822BE55D3DFE9D540CDAB",
"dark.user.css": "CFDF7076051ABC5B0528E44220832FBBAC56F37DABEE5424E6FC6CA942D311B1",
"dark-color-scheme.min.js": "6D353AC738180317ACF9D2E046BFFBA0ACC0FA7A8D22B8E16C51127CDE4FE96B",
"dark-important.min.css": "5369385A2C16188FB11E71C4C5B91275646F22F0F09E518E37813CC4FA23A072",
"dark-navbar.min.css": "7FAD547E326B768904B3739C978DF86FFDDD5E5064FB8F490710D197CCC3018B",
"dark-schedule.min.js": "853C446547603F4F0425F19F09F73335C9EC451A790C1C07E5E5B88A09E9B453",
"dark-slice-12.min.css": "83BE1C9B41F71F26E11A66DE9CDD6DF4B9115CBB69BD0EE0DB3C5C438AB8920D",
"dark-styles.min.js": "0F1F90CB24296E7399B63198A95AC429BFF351D37A186072B4FB5135AD1F2CDF",
"debounce.min.js": "54D33E1273C1F3FE19550BF1844339C3D54D6B01DF8A39C3162D95B93B079CFA",
"default-danmaku-settings.min.css": "D9942B184FEDA7B08CFA0C34920E97D7A83B81762DCBF757642EBB60F95FF25D",
@ -200,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": "C3671F3F2C9DA14EB63F63A8CE05E8A94631FD9D3ADC8981C67F407EB5C49FCC",
"show-cover-before-play.min.js": "900831DF046D2EA624FC643A2F79CA52CFC54BACC184CC8004EE270277B58950",
"show-dead-video-title.min.js": "8D591930421EBA43A1BDF50DC8B645C1BD1A17E109FB1CFBCD6B78E6C74E1D68",
"simple-home.vue.min.js": "1F5CF46DEE65549A30C5F0790578EED0C6B3AD6C5F20D9B88CD745C4B7664ABB",
"simple-home-bangumi-category.vue.min.js": "87DCA2C8295CAD66C9FA01D65437EC2F9DD5E7F4A565B4384ABAB1746A6787EE",

Binary file not shown.

View File

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

View File

@ -5,8 +5,9 @@ const url = {
]
}
const styleID = 'showCoverBeforePlayStyle'
let lastAid: string
const entry = () => {
Observer.videoChange(async () => {
const showCover = async () => {
if (url.include.every(it => !document.URL.includes(it))) {
return
}
@ -16,11 +17,18 @@ const entry = () => {
console.warn('[播放前显示封面] 未找到av号')
return
}
if (aid === lastAid) {
return
}
lastAid = aid
const video = await SpinQuery.select('video') as HTMLVideoElement
if (!video) {
console.warn('[播放前显示封面] 未找到视频')
return
}
if (!video.paused) {
return
}
const { VideoInfo } = await import('../video-info')
const info = new VideoInfo(aid)
await info.fetchInfo()
@ -28,7 +36,9 @@ const entry = () => {
video.addEventListener('play', () => {
document.body.style.removeProperty('--cover-url')
}, { once: true })
})
}
// Observer.videoChange(showCover)
showCover()
}
entry()
export default {