Actualiser custom.js

This commit is contained in:
Mylloon 2023-09-22 12:14:54 +02:00
parent fa5ff3c4e9
commit c4f2236b12
Signed by: Forgejo
GPG key ID: E72245C752A07631

View file

@ -2,7 +2,7 @@ const loopIter = 3;
const timeoutStartDuration = 200;
window.addEventListener("load", () => {
/* ocamlhljs(); */
ocamlhljs();
setTimeout(() => checker(loopIter), timeoutStartDuration);
// When clicking on a link, we recheck images
@ -44,12 +44,10 @@ relevance:0},{begin:/->/}]})})();hljs.registerLanguage("ocaml",e)};
const svgObsidianFix = () => {
for (const item of document.getElementsByTagName("img")) {
console.log(item);
if (!item.src.startsWith("data:image/svg+xml;base64,")) {
// Exclude image who aren't SVG and base64 encoded
break;
}
console.log("aaaa");
/** Convert to grayscale */
const colorToGrayscale = (color) => {
@ -93,7 +91,6 @@ const svgObsidianFix = () => {
const totalGrayscale = grayscaleValues.reduce((acc, val) => acc + val, 0);
const averageGrayscale = totalGrayscale / grayscaleValues.length;
console.log(averageGrayscale);
if (averageGrayscale < 128) {
item.style = "filter: invert(1);";
}