diff --git a/index.html b/index.html
index d42cd86..216872c 100644
--- a/index.html
+++ b/index.html
@@ -10,7 +10,9 @@
var g_playlist = null;
var g_previous = [];
var g_previous_idx = 0;
+ var g_current = 1;
var g_looping = false;
+ var g_shuffle = true;
var MAX_HISTORY = 10;
var scrubp = 0;
@@ -103,7 +105,13 @@
return;
if (g_previous_idx >= (g_previous.length - 1)) {
- g_previous.push (Math.floor (Math.random () * g_playlist.length));
+ if (g_shuffle) {
+ g_current = Math.floor (Math.random () * g_playlist.length);
+ }
+ else {
+ g_current += 1;
+ }
+ g_previous.push (g_current);
g_previous_idx = g_previous.length - 1;
}
else {
@@ -133,6 +141,8 @@
$('html, body').stop ().animate ({
scrollTop: trackelem.offset ().top - $('.control-bar').height ()
}, 1000);
+
+ g_current = trackid;
}
function loadNewPlaylist (playlist, track) {
@@ -198,6 +208,17 @@
$('#btn-loop i').toggleClass('fa-repeat', !g_looping);
}
+ function toggleShuffle () {
+ g_shuffle = !g_shuffle;
+ if (g_shuffle) {
+ $('#btn-shuffle').css('color', '#FF9148');
+ }
+ else {
+ $('#btn-shuffle').css('color', '#808080');
+ }
+
+ }
+
function populatePlaylistOptions () {
for (var name in PLAYLISTS) {
var option = $("