From d32958852a228c263a15c43cbfefee4c5b678f63 Mon Sep 17 00:00:00 2001 From: Shiba <44804845+DeepDoge@users.noreply.github.com> Date: Mon, 10 Jan 2022 00:22:20 +0000 Subject: [PATCH] =?UTF-8?q?=F0=9F=8D=99=20bugfix=20redirect=20to=20lbryapp?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/scripts/ytContent.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/scripts/ytContent.tsx b/src/scripts/ytContent.tsx index c08315a..8650a2c 100644 --- a/src/scripts/ytContent.tsx +++ b/src/scripts/ytContent.tsx @@ -63,11 +63,12 @@ async function redirectTo({ lbryPathname, platfrom, time }: Target) if (platfrom === targetPlatformSettings.app) { - open(url, '_blank') findVideoElement().then((videoElement) => { videoElement.addEventListener('play', () => videoElement.pause(), { once: true }) videoElement.pause() }) + if (document.hidden) await new Promise((resolve) => document.addEventListener('visibilitychange', resolve, { once: true })) + open(url, '_blank') if (window.history.length === 1) window.close(); else window.history.back() } @@ -141,7 +142,6 @@ window.addEventListener('load', async () => async function updateByURL(url: URL) { - console.log(url) if (url.pathname !== '/watch') return const videoId = url.searchParams.get('v')