strict syntax refine
This commit is contained in:
parent
b72f02e148
commit
3530b08ff8
1 changed files with 8 additions and 7 deletions
|
|
@ -12,14 +12,15 @@ function monitorEntry(monitorCallback) {
|
||||||
const callback = function (mutationsList, observer) {
|
const callback = function (mutationsList, observer) {
|
||||||
for (const mutation of mutationsList) {
|
for (const mutation of mutationsList) {
|
||||||
if (mutation.type === 'childList') {
|
if (mutation.type === 'childList') {
|
||||||
monitorCallback(mutationsList);
|
monitorCallback(mutationsList);
|
||||||
}
|
};
|
||||||
}
|
};
|
||||||
};
|
};
|
||||||
const observer = new MutationObserver(callback);
|
const observer = new MutationObserver(callback);
|
||||||
if(targetNode)
|
if(targetNode){
|
||||||
observer.observe(targetNode, config);
|
observer.observe(targetNode, config);
|
||||||
}
|
};
|
||||||
|
};
|
||||||
|
|
||||||
function colorize() {
|
function colorize() {
|
||||||
const entry = document.querySelectorAll('.flux_header');
|
const entry = document.querySelectorAll('.flux_header');
|
||||||
|
|
@ -27,7 +28,7 @@ function colorize() {
|
||||||
const cl = stringToColour(e.querySelector('.website').textContent) + '12';
|
const cl = stringToColour(e.querySelector('.website').textContent) + '12';
|
||||||
e.style.background = cl;
|
e.style.background = cl;
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
const stringToColour = (str) => {
|
const stringToColour = (str) => {
|
||||||
let hash = 0;
|
let hash = 0;
|
||||||
|
|
@ -38,6 +39,6 @@ const stringToColour = (str) => {
|
||||||
for (let i = 0; i < 3; i++) {
|
for (let i = 0; i < 3; i++) {
|
||||||
const value = (hash >> (i * 8)) & 0xff;
|
const value = (hash >> (i * 8)) & 0xff;
|
||||||
color += value.toString(16).padStart(2, '0');
|
color += value.toString(16).padStart(2, '0');
|
||||||
}
|
};
|
||||||
return color;
|
return color;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue