From ae2f3804c0b50ad338b1e694907b30d76e7d2ce8 Mon Sep 17 00:00:00 2001 From: sigger Date: Sun, 22 Jan 2006 05:27:55 +0000 Subject: moves mpd playlist npsong css --- lib/general.js | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/general.js b/lib/general.js index c3cf40f6..a5100222 100644 --- a/lib/general.js +++ b/lib/general.js @@ -1,6 +1,7 @@ /* The AJAX stuff */ var xmlHttp; var requestType=""; +var ret_songid=0; function createXMLHttpRequest() { @@ -67,7 +68,20 @@ function handleStateChange() { case 'now_playing' : if (player == 'mpd' && player_state != 'stop') { mpd_song_length = el.getElementsByTagName ('songlength')[0].firstChild.data; - mpd_songid = Math.round(el.getElementsByTagName ('songid')[0].firstChild.data); + ret_songid = Math.round(el.getElementsByTagName ('songid')[0].firstChild.data); + if (ret_songid != mpd_songid) { + if (document.getElementById ('mpd_row'+mpd_songid) != null) { + if ((mpd_songid - mpdpl_first) %2 == 1) { + document.getElementById ('mpd_row'+mpd_songid).className = 'even'; + } else { + document.getElementById ('mpd_row'+mpd_songid).className = 'odd'; + } + } + if (document.getElementById ('mpd_row'+ret_songid) != null) { + document.getElementById ('mpd_row'+ret_songid).className = 'npsong'; + } + mpd_songid = ret_songid; + } document.getElementById ('mpd_npinfo').firstChild.data = 1+mpd_songid + ". " + el.getElementsByTagName ('songartist')[0].firstChild.data + " - " + -- cgit