From c7b25854a4b39c23004bae675cc557c62d0d9d86 Mon Sep 17 00:00:00 2001 From: shinemoon Date: Fri, 24 Nov 2023 11:17:22 +0800 Subject: [PATCH 1/3] fix for issue 183 --- xExtension-ColorfulList/static/script.js | 36 ++++++++++++++---------- 1 file changed, 21 insertions(+), 15 deletions(-) diff --git a/xExtension-ColorfulList/static/script.js b/xExtension-ColorfulList/static/script.js index 0363fcf..199d3df 100644 --- a/xExtension-ColorfulList/static/script.js +++ b/xExtension-ColorfulList/static/script.js @@ -1,23 +1,29 @@ + + document.addEventListener('DOMContentLoaded', function(){ - function monitorEntry(monitorCallback) { - const targetNode = document.getElementById('stream'); - const config = { attributes: false, childList: true, subtree: false}; - const callback = function(mutationsList, observer) { - for(let mutation of mutationsList) { - if (mutation.type === 'childList') { - monitorCallback(mutationsList); - } - } - }; - const observer = new MutationObserver(callback); - observer.observe(targetNode, config); - //observer.disconnect(); - }; + //Initial Colorize for situation where 'no new item changes triggered later' (https://github.com/FreshRSS/Extensions/issues/183) + colorize(); + + //Insert entry monitor monitorEntry(colorize); }); +function monitorEntry(monitorCallback) { + const targetNode = document.getElementById('stream'); + const config = { attributes: false, childList: true, subtree: false}; + const callback = function(mutationsList, observer) { + for(let mutation of mutationsList) { + if (mutation.type === 'childList') { + monitorCallback(mutationsList); + } + } + }; + const observer = new MutationObserver(callback); + observer.observe(targetNode, config); + //observer.disconnect(); +}; -function colorize(entries){ +function colorize(){ let entry = document.querySelectorAll('.flux_header'); entry.forEach((e,i)=>{ let cl = stringToColour(e.querySelector('.website').textContent)+'12'; From 5b494f99fc5dac6a2aa6292c7223488426142ca0 Mon Sep 17 00:00:00 2001 From: shinemoon Date: Fri, 24 Nov 2023 11:21:47 +0800 Subject: [PATCH 2/3] info update --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index a9294c7..3630b32 100644 --- a/README.md +++ b/README.md @@ -99,3 +99,9 @@ There are some FreshRSS extensions out there, developed by community members: ### By [@rudism](https://code.sitosis.com/rudism) * [Kagi Summarizer](https://code.sitosis.com/rudism/freshrss-kagi-summarizer): Adds a "Summarize" button to the top of all entries that will fetch the summary of the entry using the [Kagi Universal Summarizer](https://kagi.com/summarizer/index.html). + + +### By [@shinemoon](https://github.com/shinemoon] + +* [Colorful List](https://github.com/shinemoon/FreshRSS-Dev/tree/master/extensions/xExtension-ColorfulList): Generate light different background color for article list rows (relying on the feed name) + From 20bf0cc22bf85be869a0e20d219fb82dd6ec0d46 Mon Sep 17 00:00:00 2001 From: shinemoon Date: Fri, 24 Nov 2023 21:42:11 +0800 Subject: [PATCH 3/3] Update version --- xExtension-ColorfulList/metadata.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xExtension-ColorfulList/metadata.json b/xExtension-ColorfulList/metadata.json index 4be6483..4188b33 100644 --- a/xExtension-ColorfulList/metadata.json +++ b/xExtension-ColorfulList/metadata.json @@ -2,7 +2,7 @@ "name": "Colorful List", "author": "Claud Xiao", "description": "Colorful Entry Title based on RSS source", - "version": 0.1, + "version": 0.2, "entrypoint": "ColorfulList", "type": "user" }