diff --git a/miniflux_scripts/feed_organizer.js b/miniflux_scripts/feed_organizer.js new file mode 100644 index 0000000..754203d --- /dev/null +++ b/miniflux_scripts/feed_organizer.js @@ -0,0 +1,54 @@ +// ==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() { + 'use strict'; + + // Function to group items by the author/feed name + function groupItemsByAuthor() { + const items = document.querySelectorAll('.item.entry-item'); + const grouped = {}; + + // Group articles by feed/author + items.forEach(item => { + const author = item.querySelector('.item-meta-info-title a').innerText.trim(); + if (!grouped[author]) { + grouped[author] = []; + } + grouped[author].push(item); + }); + + // Clear existing items safely + const container = document.querySelector('.items'); + while (container.firstChild) { + container.removeChild(container.firstChild); + } + + // Append grouped items to the DOM + 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); + }); + } + + // Run the grouping function + window.addEventListener('load', groupItemsByAuthor); +})();