From bbe2e9d08e0d916cb07a1c5a1797279d5188a137 Mon Sep 17 00:00:00 2001 From: Daniel Tam Date: Tue, 19 Jul 2022 11:20:44 -0500 Subject: [PATCH] set to start from last played song if shuffle is off when first accessing the page --- index.html | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/index.html b/index.html index 8334dca..7479d1a 100644 --- a/index.html +++ b/index.html @@ -143,6 +143,7 @@ }, 1000); g_current = trackid; + localStorage['current'] = g_current; } function loadNewPlaylist (playlist, track) { @@ -375,6 +376,9 @@ if (shuffle === 'false') { g_shuffle = false; + if (localStorage.getItem ('current') !== null) { + g_current = parseInt(localStorage.getItem ('current'))-1; + } } else { g_shuffle = true; @@ -382,7 +386,6 @@ toggleShuffleColor(); } - // If hash is set, override playlist and track var url_track = parseTrackId (window.location.hash.substr (1));