diff options
author | Jon Bergli Heier <snakebite@jvnv.net> | 2012-03-06 21:58:47 +0100 |
---|---|---|
committer | Jon Bergli Heier <snakebite@jvnv.net> | 2012-03-06 21:58:47 +0100 |
commit | 9e5cafbde816d6c3535fa7d3cc97a3f9c0fe265a (patch) | |
tree | cd952a50d7f50b146123f49be92f93ecb20d5889 /static | |
parent | 32713ba6fbe7edaeec888a3d64e7cbf16ff547b7 (diff) |
Use sequential ids to store playlist tracks in the correct order.
Diffstat (limited to 'static')
-rw-r--r-- | static/playlist.js | 4 | ||||
-rw-r--r-- | static/sound.js | 4 |
2 files changed, 6 insertions, 2 deletions
diff --git a/static/playlist.js b/static/playlist.js index 99ec6c5..6f57075 100644 --- a/static/playlist.js +++ b/static/playlist.js @@ -25,6 +25,7 @@ $(function(){ } }); PlaylistView = Backbone.View.extend({ + current_id: 1, el: $('#playlist'), initialize: function() { items.bind('add', this.addOne, this); @@ -34,6 +35,9 @@ $(function(){ items.fetch(); }, add: function(item) { + item.track_id = item.id; + item.id = this.current_id; + this.current_id++; var model = items.create(item); }, addOne: function(item) { diff --git a/static/sound.js b/static/sound.js index 252741c..874c213 100644 --- a/static/sound.js +++ b/static/sound.js @@ -1,6 +1,6 @@ function playsound(model) { var item = model.toJSON(); - var id = item.id; + var id = item.track_id; var cid = model.cid; var el = $('#cid-' + cid); el.addClass('loading'); @@ -10,7 +10,7 @@ function playsound(model) { } sound = soundManager.createSound({ id: 'audio', - url: '/track/' + item.id, + url: '/track/' + id, whileloading: function() { $('#status').text('Loading... ' + this.bytesLoaded); el.addClass('loading'); |