fix: sort feeds by total entries after Miniflux DOM change
This commit is contained in:
@@ -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);
|
||||
});
|
||||
})();
|
||||
})();
|
||||
|
Reference in New Issue
Block a user