From c2c0f789f528a1f72289a671dfac523fb785e3f0 Mon Sep 17 00:00:00 2001 From: 1hitsong <3330318+1hitsong@users.noreply.github.com> Date: Sun, 5 Feb 2023 06:59:46 -0500 Subject: [PATCH] Hide button once countdown reaches 0 Prevents showing negative numbers --- components/JFVideo.brs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/components/JFVideo.brs b/components/JFVideo.brs index 75ae3f5a..1c011ed9 100644 --- a/components/JFVideo.brs +++ b/components/JFVideo.brs @@ -65,7 +65,11 @@ end sub ' 'Update count down text sub updateCount() - m.nextEpisodeButton.text = tr("Next Episode") + " " + Int(m.top.runTime - m.top.position).toStr() + nextEpisodeCountdown = Int(m.top.runTime - m.top.position) + if nextEpisodeCountdown < 0 + nextEpisodeCountdown = 0 + end if + m.nextEpisodeButton.text = tr("Next Episode") + " " + nextEpisodeCountdown.toStr() end sub ' @@ -78,6 +82,12 @@ end sub ' Checks if we need to display the Next Episode button sub checkTimeToDisplayNextEpisode() + nextEpisodeCountdown = Int(m.top.runTime - m.top.position) + if nextEpisodeCountdown < 0 + hideNextEpisodeButton() + return + end if + if int(m.top.position) >= (m.top.runTime - Val(m.nextupbuttonseconds)) showNextEpisodeButton() updateCount()