Keep is a button on the show's page, a plus, not a switch in its settings (#280)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -34,6 +34,7 @@ function renderFeed(){
|
||||
<button class="btn ico" data-a="dl" title="Download latest…" aria-label="Download latest">${ICON.download}</button>
|
||||
<button class="btn ico" data-a="read" title="Mark all read" aria-label="Mark all read">${ICON.checks}</button>
|
||||
<button class="btn ico" data-a="pin" title="${f.pinned?'Unpin from the top of the feed list':'Pin to the top of the feed list'}" aria-label="${f.pinned?'Unpin':'Pin'}" aria-pressed="${!!f.pinned}">${f.pinned?ICON.pinOn:ICON.pin}</button>
|
||||
${keepHTML(f)}
|
||||
<button class="btn ico" data-a="share" title="Share" aria-label="Share">${ICON.share}</button>
|
||||
<button class="btn ico" data-a="settings" title="Settings" aria-label="Settings">${ICON.settings}</button>
|
||||
<button class="btn ico danger" data-a="rm" title="Unsubscribe" aria-label="Unsubscribe">${ICON.circleMinus}</button>
|
||||
@@ -161,6 +162,15 @@ function renderGroup(f: Feed,kids: Feed[]){
|
||||
draw();
|
||||
}
|
||||
|
||||
/// Keep, for a show from an OPML or a Patreon creator: it stays yours, a show of its own, should
|
||||
/// the list drop it or you leave the list (#280). A plus to keep it, a check once kept.
|
||||
function keepHTML(f: Feed){
|
||||
if(!f.managed||!f.group) return '';
|
||||
const list=S.feeds.find(p=>p.id===f.group);
|
||||
const name=esc(list?(list.title||list.id):f.group);
|
||||
const title=f.kept?`Kept: stays on your list if ${name} drops it. Stop keeping it`:`Keep it on your list if ${name} drops it`;
|
||||
return `<button class="btn ico" data-a="keep" title="${title}" aria-label="${f.kept?'Kept':'Keep'}" aria-pressed="${!!f.kept}">${f.kept?ICON.check:ICON.plus}</button>`;
|
||||
}
|
||||
async function feedAction(a: string,f: Feed){
|
||||
if(a==='scan'){
|
||||
spinStart(f.id);
|
||||
@@ -175,6 +185,12 @@ async function feedAction(a: string,f: Feed){
|
||||
await loadFeeds(true); renderFeed();
|
||||
}catch(e){ toast(why(e),true); }
|
||||
}
|
||||
if(a==='keep'){
|
||||
try{
|
||||
await api(`/api/feeds/${encodeURIComponent(f.id)}`,{method:'PATCH',body:JSON.stringify({kept:!f.kept})});
|
||||
await loadFeeds(true); renderFeed();
|
||||
}catch(e){ toast(why(e),true); }
|
||||
}
|
||||
if(a==='settings') settingsModal(f);
|
||||
if(a==='share') share(f.title||f.id, f.url, $('#content .acts [data-a="share"]'));
|
||||
if(a==='dl') downloadLatestModal(f);
|
||||
|
||||
Reference in New Issue
Block a user