strict syntax refine

This commit is contained in:
shinemoon 2023-11-25 23:10:12 +08:00
parent b72f02e148
commit 3530b08ff8

View file

@ -12,14 +12,15 @@ function monitorEntry(monitorCallback) {
const callback = function (mutationsList, observer) {
for (const mutation of mutationsList) {
if (mutation.type === 'childList') {
monitorCallback(mutationsList);
}
}
monitorCallback(mutationsList);
};
};
};
const observer = new MutationObserver(callback);
if(targetNode)
if(targetNode){
observer.observe(targetNode, config);
}
};
};
function colorize() {
const entry = document.querySelectorAll('.flux_header');
@ -27,7 +28,7 @@ function colorize() {
const cl = stringToColour(e.querySelector('.website').textContent) + '12';
e.style.background = cl;
});
}
};
const stringToColour = (str) => {
let hash = 0;
@ -38,6 +39,6 @@ const stringToColour = (str) => {
for (let i = 0; i < 3; i++) {
const value = (hash >> (i * 8)) & 0xff;
color += value.toString(16).padStart(2, '0');
}
};
return color;
};