mirror of
https://github.com/LBRYFoundation/Watch-on-LBRY.git
synced 2025-08-23 17:47:26 +00:00
🍱 Refactor bug fix
This commit is contained in:
parent
30f077ba38
commit
86879183b2
1 changed files with 6 additions and 8 deletions
|
@ -128,7 +128,7 @@ window.addEventListener('load', async () =>
|
|||
|
||||
function getVideoTime(url: URL)
|
||||
{
|
||||
return settings.redirect ?
|
||||
return settings.redirect ?
|
||||
(url.searchParams.has('t') ? parseYouTubeURLTimeString(url.searchParams.get('t')!) : null) :
|
||||
(videoElement.currentTime > 3 && videoElement.currentTime < videoElement.duration - 1 ? videoElement.currentTime : null)
|
||||
}
|
||||
|
@ -139,17 +139,15 @@ window.addEventListener('load', async () =>
|
|||
if (url.pathname !== '/watch') return
|
||||
|
||||
const videoId = url.searchParams.get('v')
|
||||
if (!videoId) return
|
||||
const lbryPathname = await requestLbryPathname(videoId)
|
||||
if (!lbryPathname) return
|
||||
const time = getVideoTime(url)
|
||||
target = { lbryPathname, platfrom: targetPlatformSettings[settings.targetPlatform], time }
|
||||
const lbryPathname = videoId && await requestLbryPathname(videoId)
|
||||
if (lbryPathname) target = { lbryPathname, platfrom: targetPlatformSettings[settings.targetPlatform], time: getVideoTime(url) }
|
||||
else target = null
|
||||
|
||||
if (settings.redirect) redirectTo(target)
|
||||
if (settings.redirect) target && redirectTo(target)
|
||||
else updateButton(buttonMountPoint, target)
|
||||
}
|
||||
|
||||
videoElement.addEventListener('timeupdate',
|
||||
videoElement.addEventListener('timeupdate',
|
||||
() => target && updateButton(buttonMountPoint, Object.assign(target, { time: getVideoTime(new URL(location.href)) })))
|
||||
|
||||
async function onUrlChange()
|
||||
|
|
Loading…
Add table
Reference in a new issue