Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for issue #183: xExtension-ColorfulList not working when only viewing unread messages #186

Merged
merged 3 commits into from
Nov 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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