From: Mike Frysinger Date: Sun, 1 Sep 2013 20:32:30 +0000 (-0400) Subject: playlist: add ability to play an item X-Git-Tag: v3.0~1 X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=17ac93ed65c5212d5cf6ecbac17b718738d82c00;p=chrome-ext%2Fmusic-player-client.git playlist: add ability to play an item --- diff --git a/main.js b/main.js index 9902b93..26d0bc7 100644 --- a/main.js +++ b/main.js @@ -274,10 +274,15 @@ function pretty_time(time) { } function playlist_del() { - mpc.deleteid(this.title); + mpc.deleteid(this.song_id); this.parentNode.remove(); } +function playlist_play() { + mpc.playid(this.song_id); + this.parentNode.style.fontWeight = 'bold'; +} + function update_ui(state, cmd) { if (typeof(state) == 'string') { ui_mpc_status.innerText = ({ @@ -323,12 +328,16 @@ function update_ui(state, cmd) { cell = row.insertCell(-1); cell.id = 'playlist_del'; cell.innerHTML = '¤'; - cell.title = song.Id; + cell.song_id = song.Id; + cell.title = 'delete'; cell.onclick = playlist_del; cell = row.insertCell(-1); cell.innerText = song.Pos; cell.style.textAlign = 'right'; + cell.song_id = song.Id; + cell.title = 'play'; + cell.onclick = playlist_play; if ('Artist' in song) { row.insertCell(-1).innerText = song.Artist;