fix for issue 183

This commit is contained in:
shinemoon 2023-11-24 11:17:22 +08:00
parent a86467db48
commit c7b25854a4

View file

@ -1,4 +1,13 @@
document.addEventListener('DOMContentLoaded', function(){ document.addEventListener('DOMContentLoaded', function(){
//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) { function monitorEntry(monitorCallback) {
const targetNode = document.getElementById('stream'); const targetNode = document.getElementById('stream');
const config = { attributes: false, childList: true, subtree: false}; const config = { attributes: false, childList: true, subtree: false};
@ -13,11 +22,8 @@ document.addEventListener('DOMContentLoaded', function(){
observer.observe(targetNode, config); observer.observe(targetNode, config);
//observer.disconnect(); //observer.disconnect();
}; };
monitorEntry(colorize);
});
function colorize(){
function colorize(entries){
let entry = document.querySelectorAll('.flux_header'); let entry = document.querySelectorAll('.flux_header');
entry.forEach((e,i)=>{ entry.forEach((e,i)=>{
let cl = stringToColour(e.querySelector('.website').textContent)+'12'; let cl = stringToColour(e.querySelector('.website').textContent)+'12';