Currently Listening: a cross takes an episode off the list
It forgets the saved position, which is what puts an episode on the list. The one in the player is closed without saving first, or its next save would put it straight back. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -1870,13 +1870,26 @@ async function renderListening(url,box){
|
||||
`<div class="txt"><b>${esc(e.title||'(untitled)')}</b>`+
|
||||
`<small class="meta">${esc(feedName(e.feed_id))} · ${clock(e.position)} of ${e.duration?clock(e.duration):'?'}</small>`+
|
||||
`<div class="dlbar live"><i style="width:${pct}%"></i></div></div>`+
|
||||
`<button class="btn ico primary" title="Resume" aria-label="Resume">${ICON.play}</button>`;
|
||||
el.onclick=()=>play(e);
|
||||
`<button class="btn ico primary" title="Resume" aria-label="Resume">${ICON.play}</button>`+
|
||||
`<button class="btn ico" data-a="remove" title="Remove from Currently Listening" aria-label="Remove from Currently Listening">${ICON.close}</button>`;
|
||||
el.onclick=ev=>ev.target.closest('[data-a=remove]')?forget(e):play(e);
|
||||
box.appendChild(el);
|
||||
}
|
||||
return rows.length;
|
||||
}
|
||||
|
||||
/// Takes an episode off Currently Listening by forgetting where you got to: the list is every
|
||||
/// episode with a saved position short of the end, so the position is what has to go.
|
||||
async function forget(e){
|
||||
// Closed without saving first, or the player's next save would put it straight back.
|
||||
if(player.guid===e.guid){ player.guid=null; $('#pclose').click(); }
|
||||
try{
|
||||
await api(`/api/entries/${encodeURIComponent(e.feed_id)}/${encodeURIComponent(e.guid)}/position`,
|
||||
{method:'POST',body:JSON.stringify({secs:0})});
|
||||
}catch(err){ toast(err.message,true); }
|
||||
if(S.feed===':listening') renderListed(VIEWS[':listening']);
|
||||
}
|
||||
|
||||
// The toolbar acts on whatever is selected: the feed on the left, the item in the table.
|
||||
$('#tbRemove').onclick=()=>{ const f=S.feeds.find(x=>x.id===S.feed); if(f) removeFeed(f); };
|
||||
$('#tbPlay').onclick=()=>{ const e=cur(); if(e) play(e); };
|
||||
|
||||
Reference in New Issue
Block a user