Actualiser custom.js

This commit is contained in:
Mylloon 2023-09-22 11:55:44 +02:00
parent 5e94213f75
commit d7923fa1cc
Signed by: Forgejo
GPG key ID: E72245C752A07631

View file

@ -1,14 +1,20 @@
window.addEventListener("load", () => { window.addEventListener("load", () => {
ocamlhljs(); ocamlhljs();
setTimeout(() => checker(3), 500); setTimeout(() => checker(3), 200);
// When clicking on a link, we recheck images
document.addEventListener("click", () => {
setTimeout(() => checker(3), 200);
});
}); });
/** Check multiple times because the page takes times to load */
const checker = (count) => { const checker = (count) => {
if (count == 0) { if (count == 0) {
return; return;
} }
if (document.getElementsByTagName("img").length === 0) { if (document.getElementsByTagName("img").length === 0) {
setTimeout(() => checker(count - 1), 500); setTimeout(() => checker(count - 1), 200);
} else { } else {
svgObsidianFix(); svgObsidianFix();
} }