Tapping the player bar, or Enter on it, opens a sheet over the feeds and the list: the episode's artwork large, its podcast, its show notes and Up Next. The bar stays below it with the controls, so there is one set of them rather than a second kept in step. Chapters are left for #477: nothing reads them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
47 lines
2.1 KiB
TypeScript
47 lines
2.1 KiB
TypeScript
/* ---------------- Now Playing ---------------- */
|
|
/// Now Playing (#475): what is playing, opened from the player bar. Its artwork large, the
|
|
/// podcast it is from, its show notes and what follows in Up Next. The bar stays below it with
|
|
/// the controls, so there is one set of them, not a second to keep in step.
|
|
const nowSheet=$('#nowsheet');
|
|
const nowOpen=()=>!nowSheet.hidden;
|
|
|
|
function openNow(){
|
|
if(!player.guid) return;
|
|
nowSheet.hidden=false;
|
|
$('#pnow').setAttribute('aria-expanded','true');
|
|
drawNow();
|
|
$<HTMLButtonElement>('#nowclose').focus();
|
|
}
|
|
function closeNow(){
|
|
if(!nowOpen()) return;
|
|
nowSheet.hidden=true;
|
|
$('#pnow').setAttribute('aria-expanded','false');
|
|
$('#pnow').focus();
|
|
}
|
|
/// Drawn again whenever what plays or what follows changes, while it is open.
|
|
function drawNow(){
|
|
const e=player.entry;
|
|
if(!nowOpen()) return;
|
|
if(!e||!player.guid){ closeNow(); return; }
|
|
const name=entryName(e).text, show=feedName(e.feed_id);
|
|
nowSheet.innerHTML=`
|
|
<button class="iconbtn" id="nowclose" title="Close Now Playing (Esc)" aria-label="Close Now Playing">${ICON.close}</button>
|
|
<div class="nowhead">
|
|
${artHTML(e.image||feedArt(e.feed_id),show,'nowart')}
|
|
<div class="nowmeta">
|
|
<h2>${esc(name)}</h2>
|
|
<button type="button" class="nowshow">${esc(show)}</button>
|
|
<small>${[dateOf(e.published),e.duration?clock(e.duration):''].filter(Boolean).join(', ')}</small>
|
|
</div>
|
|
</div>
|
|
${upNext.length?`<h3>Up Next</h3><div class="childlist" id="nowqueue"></div>`:''}
|
|
<h3>Show notes</h3>
|
|
<div class="dbody">${textOf(e)}</div>`;
|
|
$<HTMLButtonElement>('#nowclose').onclick=closeNow;
|
|
$<HTMLButtonElement>('.nowshow',nowSheet).onclick=()=>{ closeNow(); selectFeed(e.feed_id); };
|
|
const q=$('#nowqueue');
|
|
for(const x of upNext) q?.appendChild(listenRow(x,'Remove from Up Next',()=>saveUpNext(upNext.filter(y=>entryKey(y)!==entryKey(x)))));
|
|
}
|
|
$('#pnow').onclick=()=>nowOpen()?closeNow():openNow();
|
|
$('#pnow').onkeydown=(ev: KeyboardEvent)=>{ if(ev.key==='Enter'||ev.key===' '){ ev.preventDefault(); $('#pnow').click(); } };
|