From fc44002695d7fa5974061a8b4dda463452f94597 Mon Sep 17 00:00:00 2001 From: Daniel Tam Date: Sat, 16 Jul 2022 23:18:13 -0500 Subject: [PATCH] reoptimized where to set the initial random song --- index.html | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/index.html b/index.html index d87c3b1..b7cd031 100644 --- a/index.html +++ b/index.html @@ -105,7 +105,7 @@ return; if (g_previous_idx >= (g_previous.length - 1)) { - if (g_shuffle || g_current === -1) { + if (g_shuffle) { g_current = Math.floor (Math.random () * g_playlist.length); } else { @@ -188,6 +188,9 @@ if (elements.length > 0) { elements[0].click (); } else { + if (g_current === -1) { + g_current = Math.floor (Math.random () * g_playlist.length); + } playNextTrack (); } }