From 5164d69c90c50773855d732cb941d16fde6bee12 Mon Sep 17 00:00:00 2001 From: JLoeve Date: Fri, 8 Jan 2021 20:23:06 +0800 Subject: [PATCH] =?UTF-8?q?fix(return-begin):=20=E4=BF=AE=E5=A4=8D=20toast?= =?UTF-8?q?=20=E6=97=B6=E9=97=B4=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/video/keymap/keymap.ts | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/src/video/keymap/keymap.ts b/src/video/keymap/keymap.ts index 40b819f9e..3a5d5b2b5 100644 --- a/src/video/keymap/keymap.ts +++ b/src/video/keymap/keymap.ts @@ -202,10 +202,17 @@ if (supportedUrls.some(url => document.URL.startsWith(url))) { previousFrame: clickElement('.prev-frame'), nextFrame: clickElement('.next-frame'), returnBegin: () => { - if (unsafeWindow.player) { - unsafeWindow.player.play() - setTimeout(() => unsafeWindow.player.seek(0)) + if (!unsafeWindow.player) { + return } + unsafeWindow.player.play() + setTimeout(() => { + unsafeWindow.player.seek(0) + const toastText = dq(".bilibili-player-video-toast-bottom .bilibili-player-video-toast-item:first-child .bilibili-player-video-toast-item-text span:nth-child(2)") + if (toastText) { + toastText.textContent = " 00:00" + } + }) }, } const defaultBindings: { [action in keyof typeof actions]: string } = { @@ -243,11 +250,11 @@ if (supportedUrls.some(url => document.URL.startsWith(url))) { } ;(async () => { - const { loadKeyBindings } = await import('./key-bindings') - config = loadKeyBindings(parseBindings( - { ...defaultBindings, ...settings.customKeyBindings } - )) - })() + const { loadKeyBindings } = await import('./key-bindings') + config = loadKeyBindings(parseBindings( + { ...defaultBindings, ...settings.customKeyBindings } + )) + })() } export default {