Merge branch 'master' into phpstan
This commit is contained in:
commit
dcd725de8d
4 changed files with 30 additions and 17 deletions
|
|
@ -2,7 +2,7 @@
|
|||
"name": "Colorful List",
|
||||
"author": "Claud Xiao",
|
||||
"description": "Colorful Entry Title based on RSS source",
|
||||
"version": "0.2",
|
||||
"version": 0.3,
|
||||
"entrypoint": "ColorfulList",
|
||||
"type": "user"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,22 +1,29 @@
|
|||
'use strict';
|
||||
|
||||
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 (const 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 colorize(entries) {
|
||||
function monitorEntry(monitorCallback) {
|
||||
const targetNode = document.getElementById('stream');
|
||||
const config = { attributes: false, childList: true, subtree: false };
|
||||
const callback = function (mutationsList, observer) {
|
||||
for (const mutation of mutationsList) {
|
||||
if (mutation.type === 'childList') {
|
||||
monitorCallback(mutationsList);
|
||||
}
|
||||
}
|
||||
};
|
||||
const observer = new MutationObserver(callback);
|
||||
observer.observe(targetNode, config);
|
||||
// observer.disconnect();
|
||||
}
|
||||
|
||||
function colorize() {
|
||||
const entry = document.querySelectorAll('.flux_header');
|
||||
entry.forEach((e, i) => {
|
||||
const cl = stringToColour(e.querySelector('.website').textContent) + '12';
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue