summaryrefslogtreecommitdiff
path: root/static
diff options
context:
space:
mode:
Diffstat (limited to 'static')
-rw-r--r--static/playlist.js8
-rw-r--r--static/sound.js8
2 files changed, 16 insertions, 0 deletions
diff --git a/static/playlist.js b/static/playlist.js
index 6f57075..b94de61 100644
--- a/static/playlist.js
+++ b/static/playlist.js
@@ -39,6 +39,9 @@ $(function(){
item.id = this.current_id;
this.current_id++;
var model = items.create(item);
+ if(items.indexOf(model) < 2) {
+ sound_hint(model);
+ }
},
addOne: function(item) {
var view = new PlaylistItemView({model: item});
@@ -60,6 +63,11 @@ $(function(){
items.remove(item);
this.render();
return next;
+ },
+ hintnext: function() {
+ var next = items.at(1);
+ if(next)
+ sound_hint(next);
}
});
diff --git a/static/sound.js b/static/sound.js
index 874c213..c4f2dbf 100644
--- a/static/sound.js
+++ b/static/sound.js
@@ -1,4 +1,5 @@
function playsound(model) {
+ playlist.hintnext();
var item = model.toJSON();
var id = item.track_id;
var cid = model.cid;
@@ -51,3 +52,10 @@ function playsound(model) {
sound.play();
$('#cid-' + cid).addClass('playing');
}
+
+function sound_hint(model) {
+ $('#cid-' + model.cid).addClass('loading');
+ $.get('/json/hint/' + model.attributes.track_id, function(data) {
+ $('#cid-' + model.cid).removeClass('nocache').removeClass('loading');
+ });
+}