2024-11-18 15:25:31 +00:00
|
|
|
// ==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==
|
|
|
|
|
2024-08-20 14:05:35 +00:00
|
|
|
(function() {
|
|
|
|
'use strict';
|
|
|
|
|
2024-11-18 15:25:31 +00:00
|
|
|
// Function to group items by the author/feed name
|
2024-08-20 14:05:35 +00:00
|
|
|
function groupItemsByAuthor() {
|
|
|
|
const items = document.querySelectorAll('.item.entry-item');
|
|
|
|
const grouped = {};
|
|
|
|
|
2024-11-18 15:25:31 +00:00
|
|
|
// Group articles by feed/author
|
2024-08-20 14:05:35 +00:00
|
|
|
items.forEach(item => {
|
|
|
|
const author = item.querySelector('.item-meta-info-title a').innerText.trim();
|
|
|
|
if (!grouped[author]) {
|
|
|
|
grouped[author] = [];
|
|
|
|
}
|
|
|
|
grouped[author].push(item);
|
|
|
|
});
|
|
|
|
|
2024-11-18 15:25:31 +00:00
|
|
|
// Clear existing items safely
|
2024-08-20 14:05:35 +00:00
|
|
|
const container = document.querySelector('.items');
|
|
|
|
while (container.firstChild) {
|
|
|
|
container.removeChild(container.firstChild);
|
|
|
|
}
|
|
|
|
|
2024-11-18 15:25:31 +00:00
|
|
|
// Append grouped items to the DOM
|
2024-08-20 14:05:35 +00:00
|
|
|
Object.keys(grouped).forEach(author => {
|
|
|
|
const block = document.createElement('div');
|
|
|
|
block.classList.add('author-block');
|
|
|
|
const header = document.createElement('h2');
|
|
|
|
header.textContent = author;
|
|
|
|
block.appendChild(header);
|
|
|
|
|
|
|
|
grouped[author].forEach(item => {
|
|
|
|
block.appendChild(item);
|
|
|
|
});
|
|
|
|
|
|
|
|
container.appendChild(block);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2024-11-18 15:25:31 +00:00
|
|
|
// Run the grouping function
|
|
|
|
window.addEventListener('load', groupItemsByAuthor);
|
|
|
|
})();
|