X-Git-Url: https://git.wh0rd.org/?p=chrome-ext%2Fmusic-player-client.git;a=blobdiff_plain;f=main.js;h=9902b935d01e7042570268c13be9d07b82f337c1;hp=aa4c7bd961f329b5506724635ae7e4c7b6b72908;hb=9cb957ede33364c6ba1b19529050a24cd2aa8f5f;hpb=ee26ebe43d89016c3014e030041e363e337f4ff5 diff --git a/main.js b/main.js index aa4c7bd..9902b93 100644 --- a/main.js +++ b/main.js @@ -110,6 +110,7 @@ function tramp_mpc_consume() { mpc.consume(val); setToggleButton(this, val); } +function tramp_mpc_deleteid() { mpc.deleteid(this.title); } function tramp_mpc_next() { mpc.next(); } function tramp_mpc_pause() { mpc.pause(); } function tramp_mpc_play() { mpc.play(); } @@ -272,6 +273,11 @@ function pretty_time(time) { return ret + ("00" + sec).substr(-2); } +function playlist_del() { + mpc.deleteid(this.title); + this.parentNode.remove(); +} + function update_ui(state, cmd) { if (typeof(state) == 'string') { ui_mpc_status.innerText = ({ @@ -314,6 +320,12 @@ function update_ui(state, cmd) { if (song.Pos == currentsong.Pos) row.style.fontWeight = 'bold'; + cell = row.insertCell(-1); + cell.id = 'playlist_del'; + cell.innerHTML = '¤'; + cell.title = song.Id; + cell.onclick = playlist_del; + cell = row.insertCell(-1); cell.innerText = song.Pos; cell.style.textAlign = 'right';