From 17ac93ed65c5212d5cf6ecbac17b718738d82c00 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Sun, 1 Sep 2013 16:32:30 -0400 Subject: [PATCH] playlist: add ability to play an item --- main.js | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) 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; -- 2.39.5