fix: sort feeds by total entries after Miniflux DOM change

This commit is contained in:
2025-08-28 07:56:35 +00:00
parent 85a9aebc58
commit 8c2fe82238

View File

@@ -3,8 +3,13 @@
'use strict';
if (!window.location.href.match(/\/feeds$/)) return;
function parseTotal(feed) {
const spans = feed.querySelectorAll('.feed-entries-counter span[aria-hidden="true"]');
return spans[3] ? parseInt(spans[3].textContent, 10) : 0;
const counter = feed.querySelector('.feed-entries-counter');
if (!counter) return 0;
const spans = counter.querySelectorAll('span[aria-hidden="true"]');
if (!spans.length) return 0;
const txt = spans[spans.length - 1].textContent || '';
const m = txt.match(/\d+/);
return m ? parseInt(m[0], 10) : 0;
}
function sortFeeds(desc) {
const feeds = Array.from(document.querySelectorAll('article.item.feed-item'));
@@ -29,4 +34,4 @@
li.appendChild(btn);
navList.appendChild(li);
});
})();
})();