summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJon Bergli Heier <snakebite@jvnv.net>2011-08-13 12:46:26 +0200
committerJon Bergli Heier <snakebite@jvnv.net>2011-08-13 12:46:26 +0200
commit125679b35e66f32cc4d7a1878222de4ebb3f69cd (patch)
tree0272f194f73f00305c1db24e5eeb23e130fb1429
parent9ba0d656adb53cd1722bf98e470ca4940799c150 (diff)
Recode next track, handled on client-side.
-rw-r--r--static/player.js4
-rw-r--r--static/playlist.js15
2 files changed, 15 insertions, 4 deletions
diff --git a/static/player.js b/static/player.js
index 2fa8793..d10080b 100644
--- a/static/player.js
+++ b/static/player.js
@@ -27,9 +27,7 @@ function MusicListing(type, path, name, cached) {
}
this.recode = function() {
- var path = '/recode?path=' + encodeURIComponent(this.path) +
- '&decoder=' + document.getElementById('trans_from').value +
- '&encoder=' + document.getElementById('trans_to').value;
+ var path = '/recode?path=' + encodeURIComponent(this.path);
var a = this.a;
var ml = this;
var xmlhttp = new XMLHttpRequest();
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() {