A playlist row's X marks the episode played (#497)

renderPlaylist set an onclick of its own over listenRow's, to play on
through the playlist, and returned early for a click on the X instead of
calling its remove, so Mark played never ran. listenRow now takes what a
play click does, and the playlist passes playFrom instead of replacing the
handler.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RqkrVBuJRne2JAhFpaDV2U
This commit is contained in:
2026-11-22 18:30:01 -05:00
parent 5786a0cb1c
commit 9ef9359fe6
4 changed files with 15 additions and 10 deletions

View File

@@ -366,8 +366,9 @@ function drawListening(box: HTMLElement,rows: Entry[]){
for(const e of rows) box.appendChild(listenRow(e,'Remove from Currently Listening',()=>forget(e)));
}
/// An episode's row in Currently Listening and Up Next: its art, how far in, play, and a button
/// to take it out of the list, which `remove` does.
function listenRow(e: Entry,removeLabel: string,remove: ()=>void){
/// to take it out of the list, which `remove` does. `start` plays it: a playlist's goes on through
/// the playlist.
function listenRow(e: Entry,removeLabel: string,remove: ()=>void,start=()=>play(e)){
// Carries its episode, for paintListenRow to repaint as the player moves.
const el: HTMLDivElement & {entry?: Entry}=document.createElement('div');
el.className='childrow';
@@ -379,7 +380,7 @@ function listenRow(e: Entry,removeLabel: string,remove: ()=>void){
`<button class="iconbtn" data-a="remove" title="${removeLabel}" aria-label="${removeLabel}">${ICON.close}</button>`+
`<div class="rail"><i></i></div>`;
el.onclick=ev=>(ev.target as Element).closest('[data-a=remove]')?remove()
:el.classList.contains('now')&&!audio.paused?audio.pause():play(e);
:el.classList.contains('now')&&!audio.paused?audio.pause():start();
paintListenRow(el);
return el;
}