From 6637c257c99e777ff691246bd98f4fdfdc334df7 Mon Sep 17 00:00:00 2001
From: ale <ale@incal.net>
Date: Sun, 24 Jul 2011 19:06:33 +0100
Subject: [PATCH] tiny fix to allSongs()

---
 server/djrandom/frontend/static/player.js | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/server/djrandom/frontend/static/player.js b/server/djrandom/frontend/static/player.js
index bb4e4bc..ee9a517 100644
--- a/server/djrandom/frontend/static/player.js
+++ b/server/djrandom/frontend/static/player.js
@@ -101,11 +101,12 @@ djr.Playlist = function(uuid) {
 
 // Return an array with all songs, in order.
 djr.Playlist.prototype.allSongs = function() {
-  var songs = [];
-  $.each(this.chunks, function(idx, chunk_id) {
-    $.each(this.chunk_map[chunk_id].songs, function(idx2, song) {
-      songs.push(song);
-    })});
+  var songs = [], i, j;
+  for (i = 0; i < this.chunks.length; i++) {
+    for (j = 0; j < this.chunk_map[this.chunks[chunk_id]].songs.length; j++) {
+      songs.push(this.chunk_map[this.chunks[chunk_id]].songs[j]);
+    }
+  }
   return songs;
 };
 
-- 
GitLab