From 7c50daf7fc06d5c25d6c0b368a38583bad689e5c Mon Sep 17 00:00:00 2001
From: Shiba <44804845+DeepDoge@users.noreply.github.com>
Date: Fri, 7 Jan 2022 20:56:56 +0000
Subject: [PATCH] =?UTF-8?q?=F0=9F=A5=9E=20timestamp=20feature=20made=20mor?=
=?UTF-8?q?e=20smart?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
- if time is smaller than 3 dont add timestamp
- if the video ended dont add timestamp
---
src/scripts/ytContent.tsx | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/scripts/ytContent.tsx b/src/scripts/ytContent.tsx
index 20bd76f..3281698 100644
--- a/src/scripts/ytContent.tsx
+++ b/src/scripts/ytContent.tsx
@@ -112,11 +112,13 @@ function updateButton(ctx: UpdateContext | null): void {
if (!mountPoint) return
if (!ctx) return render(, mountPoint)
if (ctx.descriptor.type !== 'video') return;
- const time = videoElement?.currentTime ?? 0
const lbryPathname = ctx.lbryPathname
const targetPlatform = ctx.targetPlatform
+ let time: number = videoElement?.currentTime ?? 0
+ if (time < 3) time = 0
+ if (time >= (videoElement?.duration ?? 0) - 1) time = 0
- render(, mountPoint)
+ render(, mountPoint)
}
function redirectTo({ targetPlatform, lbryPathname }: UpdateContext): void {