fix for issue 183
This commit is contained in:
parent
a86467db48
commit
c7b25854a4
1 changed files with 21 additions and 15 deletions
|
|
@ -1,23 +1,29 @@
|
||||||
|
|
||||||
|
|
||||||
document.addEventListener('DOMContentLoaded', function(){
|
document.addEventListener('DOMContentLoaded', function(){
|
||||||
function monitorEntry(monitorCallback) {
|
//Initial Colorize for situation where 'no new item changes triggered later' (https://github.com/FreshRSS/Extensions/issues/183)
|
||||||
const targetNode = document.getElementById('stream');
|
colorize();
|
||||||
const config = { attributes: false, childList: true, subtree: false};
|
|
||||||
const callback = function(mutationsList, observer) {
|
//Insert entry monitor
|
||||||
for(let mutation of mutationsList) {
|
|
||||||
if (mutation.type === 'childList') {
|
|
||||||
monitorCallback(mutationsList);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
const observer = new MutationObserver(callback);
|
|
||||||
observer.observe(targetNode, config);
|
|
||||||
//observer.disconnect();
|
|
||||||
};
|
|
||||||
monitorEntry(colorize);
|
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');
|
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';
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue