strict syntax refine

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

View file

@ -13,13 +13,14 @@ function monitorEntry(monitorCallback) {
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;
}; };