reoptimized where to set the initial random song

This commit is contained in:
2022-07-16 23:18:13 -05:00
parent 53ccbee8f4
commit fc44002695

View File

@@ -105,7 +105,7 @@
return; return;
if (g_previous_idx >= (g_previous.length - 1)) { 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); g_current = Math.floor (Math.random () * g_playlist.length);
} }
else { else {
@@ -188,6 +188,9 @@
if (elements.length > 0) { if (elements.length > 0) {
elements[0].click (); elements[0].click ();
} else { } else {
if (g_current === -1) {
g_current = Math.floor (Math.random () * g_playlist.length);
}
playNextTrack (); playNextTrack ();
} }
} }