From 125679b35e66f32cc4d7a1878222de4ebb3f69cd Mon Sep 17 00:00:00 2001 From: Jon Bergli Heier Date: Sat, 13 Aug 2011 12:46:26 +0200 Subject: Recode next track, handled on client-side. --- static/playlist.js | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'static/playlist.js') diff --git a/static/playlist.js b/static/playlist.js index 5e41de5..38db463 100644 --- a/static/playlist.js +++ b/static/playlist.js @@ -4,7 +4,7 @@ function Playlist(pl, audio) { this.current = null; this.get = function(path) { - var li = this.current; + var li = this.pl.getElementsByTagName('li')[0]; while(li) { var a = li.getElementsByTagName('a')[0]; if(a.ml.path == path) @@ -27,12 +27,25 @@ function Playlist(pl, audio) { a.setAttribute('class', 'playing'); pl.current = li; ml.play(); + + var nextsong = li.nextElementSibling; + log('nextsong: ' + nextsong); + if(nextsong) { + var nexta = nextsong.getElementsByTagName('a')[0]; + log('nexta: ' + nexta); + log('next ml: ' + nexta.ml); + nexta.ml.recode(); + } + return false; } log(a.click); li.appendChild(a); this.pl.appendChild(li); + + if(this.pl.firstChild == li || (this.current && this.current.nextElementSibling == li)) + ml.recode(); } this.next = function() { -- cgit v1.2.3