Change(Miniflux): move feed organizer to global settings
This commit is contained in:
parent
d59ad5bab4
commit
428ad94b3a
@ -1,24 +1,15 @@
|
|||||||
// ==UserScript==
|
|
||||||
// @name Miniflux Feed Organizer
|
|
||||||
// @namespace http://tampermonkey.net/
|
|
||||||
// @version 0.1
|
|
||||||
// @description Group Miniflux feed entries by feed/author on unread, read, and starred pages
|
|
||||||
// @author https://gitea.zoemp.be/sansguidon
|
|
||||||
// @match https://YOUR_MINIFLUX_DOMAIN/unread*
|
|
||||||
// @match https://YOUR_MINIFLUX_DOMAIN/category/*/entries
|
|
||||||
// @match https://YOUR_MINIFLUX_DOMAIN/starred*
|
|
||||||
// @grant none
|
|
||||||
// ==/UserScript==
|
|
||||||
|
|
||||||
(function() {
|
(function() {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
// Function to group items by the author/feed name
|
|
||||||
function groupItemsByAuthor() {
|
function groupItemsByAuthor() {
|
||||||
const items = document.querySelectorAll('.item.entry-item');
|
const items = document.querySelectorAll('.item.entry-item');
|
||||||
|
if (!items.length) {
|
||||||
|
setTimeout(groupItemsByAuthor, 500); // Retry after 500 ms
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const grouped = {};
|
const grouped = {};
|
||||||
|
|
||||||
// Group articles by feed/author
|
|
||||||
items.forEach(item => {
|
items.forEach(item => {
|
||||||
const author = item.querySelector('.item-meta-info-title a').innerText.trim();
|
const author = item.querySelector('.item-meta-info-title a').innerText.trim();
|
||||||
if (!grouped[author]) {
|
if (!grouped[author]) {
|
||||||
@ -27,13 +18,11 @@
|
|||||||
grouped[author].push(item);
|
grouped[author].push(item);
|
||||||
});
|
});
|
||||||
|
|
||||||
// Clear existing items safely
|
|
||||||
const container = document.querySelector('.items');
|
const container = document.querySelector('.items');
|
||||||
while (container.firstChild) {
|
while (container.firstChild) {
|
||||||
container.removeChild(container.firstChild);
|
container.removeChild(container.firstChild);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Append grouped items to the DOM
|
|
||||||
Object.keys(grouped).forEach(author => {
|
Object.keys(grouped).forEach(author => {
|
||||||
const block = document.createElement('div');
|
const block = document.createElement('div');
|
||||||
block.classList.add('author-block');
|
block.classList.add('author-block');
|
||||||
@ -49,6 +38,5 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Run the grouping function
|
setTimeout(groupItemsByAuthor, 500); // Delay after initial page loading
|
||||||
window.addEventListener('load', groupItemsByAuthor);
|
})();
|
||||||
})();
|
|
Loading…
Reference in New Issue
Block a user