From 95cf62a2a9f43abf2f12e0cd187137951c1a8095 Mon Sep 17 00:00:00 2001 From: SansGuidon Date: Mon, 18 Nov 2024 15:25:31 +0000 Subject: [PATCH] revert 428ad94b3a461f24c2139740ed8a575f5a1656b8 revert Change(Miniflux): move feed organizer to global settings --- miniflux_scripts/feed_organizer.js | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/miniflux_scripts/feed_organizer.js b/miniflux_scripts/feed_organizer.js index 27be4be..754203d 100644 --- a/miniflux_scripts/feed_organizer.js +++ b/miniflux_scripts/feed_organizer.js @@ -1,15 +1,24 @@ +// ==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'); - if (!items.length) { - setTimeout(groupItemsByAuthor, 500); // Retry after 500 ms - return; - } - const grouped = {}; + // Group articles by feed/author items.forEach(item => { const author = item.querySelector('.item-meta-info-title a').innerText.trim(); if (!grouped[author]) { @@ -18,11 +27,13 @@ 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'); @@ -38,5 +49,6 @@ }); } - setTimeout(groupItemsByAuthor, 500); // Delay after initial page loading -})(); \ No newline at end of file + // Run the grouping function + window.addEventListener('load', groupItemsByAuthor); +})();