Sum a subscription's counts from the feeds it holds
An OPML folder has no entries of its own, so its row always showed zero unread however much was waiting inside. Summed from every feed it holds -- not just the ones a filter left showing, so the count doesn't move as you type -- with the badge capped at 999+ so a four-digit number doesn't eat the title beside it. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AdXho5tTkjFLeUXKbEjKBh
This commit is contained in:
@@ -56,6 +56,15 @@ and until now nothing set them.
|
||||
|
||||
---
|
||||
|
||||
## 2026-09-10 — A folder counts what it holds
|
||||
|
||||
An OPML subscription has no entries of its own, so its row always read `0 unread` no matter how much
|
||||
was waiting inside it. Unread and saved are now summed from the feeds it holds -- from all of them,
|
||||
not just the ones a search filter left showing, so the number doesn't move as you type. The badge
|
||||
caps at `999+` (the real figure is in its tooltip); a four-digit count ate the title beside it.
|
||||
|
||||
---
|
||||
|
||||
## 2026-09-10 — Sidebar alignment
|
||||
|
||||
The feed list had four different left edges: a row with no children skipped the chevron entirely, so
|
||||
|
||||
@@ -457,6 +457,13 @@ function renderFeeds(){
|
||||
}
|
||||
for(const [f,depth] of order){
|
||||
const kids=shown.filter(c=>c.group===f.id).length;
|
||||
// A subscription holds no entries itself, so its counts are the sum of what is inside --
|
||||
// taken from every feed it holds, not just the ones a filter left showing.
|
||||
const mine=S.feeds.filter(c=>c.group===f.id);
|
||||
const sum=k=>mine.reduce((n,c)=>n+(c[k]||0),0);
|
||||
const [unread,eps,saved]=mine.length
|
||||
? [sum('unread'),sum('entries'),sum('downloaded')]
|
||||
: [f.unread,f.entries,f.downloaded];
|
||||
const el=document.createElement('div');
|
||||
el.className='feed'+(S.feed===f.id?' sel':'')+(depth?' child':'')+(kids?' group':'');
|
||||
const open = kids && (expanded.has(f.id) || q);
|
||||
@@ -464,11 +471,11 @@ function renderFeeds(){
|
||||
`<span class="chev${open?' open':''}"${kids?' title="Show or hide the feeds inside"':''}>${kids?'▶':''}</span>`+
|
||||
artHTML(f.image,f.title||f.id)+
|
||||
`<div class="txt"><b>${esc(f.title||f.id)}</b><small>`+
|
||||
(kids?`${kids} feed${kids===1?'':'s'}${f.unread?` · ${f.unread} unread`:''}`
|
||||
:`${f.entries} eps · ${f.downloaded} saved`)+
|
||||
(mine.length?`${mine.length} feed${mine.length===1?'':'s'} · ${saved} saved`
|
||||
:`${eps} eps · ${saved} saved`)+
|
||||
`</small></div>`+
|
||||
(f.orphaned?'<span class="tag" title="No longer listed in the OPML, kept because it has downloads">gone</span>':'')+
|
||||
`<span class="badge${f.unread?'':' zero'}">${f.unread}</span>`;
|
||||
`<span class="badge${unread?'':' zero'}" title="${unread} unread">${unread>999?'999+':unread}</span>`;
|
||||
el.onclick=()=>{ selectFeed(f.id); $('#sidebar').classList.remove('open'); };
|
||||
if(kids) $('.chev',el).onclick=ev=>{ ev.stopPropagation(); toggleGroup(f.id); };
|
||||
list.appendChild(el);
|
||||
|
||||
Reference in New Issue
Block a user