added shuffle status to localstorage
This commit is contained in:
21
index.html
21
index.html
@@ -210,13 +210,18 @@
|
|||||||
|
|
||||||
function toggleShuffle () {
|
function toggleShuffle () {
|
||||||
g_shuffle = !g_shuffle;
|
g_shuffle = !g_shuffle;
|
||||||
|
toggleShuffleColor();
|
||||||
|
|
||||||
|
localStorage['shuffle'] = g_shuffle;
|
||||||
|
}
|
||||||
|
|
||||||
|
function toggleShuffleColor() {
|
||||||
if (g_shuffle) {
|
if (g_shuffle) {
|
||||||
$('#btn-shuffle').css('color', '#FF9148');
|
$('#btn-shuffle').css('color', '#FF9148');
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$('#btn-shuffle').css('color', '#808080');
|
$('#btn-shuffle').css('color', '#808080');
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function populatePlaylistOptions () {
|
function populatePlaylistOptions () {
|
||||||
@@ -355,6 +360,20 @@
|
|||||||
playlist = localStorage.getItem ('playlist');
|
playlist = localStorage.getItem ('playlist');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (localStorage.getItem ('shuffle') !== null) {
|
||||||
|
let shuffle = localStorage.getItem('shuffle');
|
||||||
|
|
||||||
|
if (shuffle === 'false') {
|
||||||
|
g_shuffle = false;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
g_shuffle = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
toggleShuffleColor();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// If hash is set, override playlist and track
|
// If hash is set, override playlist and track
|
||||||
var url_track = parseTrackId (window.location.hash.substr (1));
|
var url_track = parseTrackId (window.location.hash.substr (1));
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user