Skip to content

Commit

Permalink
Fix for issue #183: xExtension-ColorfulList not working when only vie…
Browse files Browse the repository at this point in the history
…wing unread messages (#186)

* fix for issue 183

* info update

* Update version

---------

Co-authored-by: shinemoon <[email protected]>
  • Loading branch information
shinemoon and iclaud authored Nov 24, 2023
1 parent a86467d commit 56bbd7a
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 16 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)

2 changes: 1 addition & 1 deletion xExtension-ColorfulList/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
36 changes: 21 additions & 15 deletions xExtension-ColorfulList/static/script.js
Original file line number Diff line number Diff line change
@@ -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';
Expand Down

0 comments on commit 56bbd7a

Please sign in to comment.