Hide button once countdown reaches 0

Prevents showing negative numbers
This commit is contained in:
1hitsong 2023-02-05 06:59:46 -05:00
parent c3e88f9e08
commit c2c0f789f5

View File

@ -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()