Actualiser custom.js
This commit is contained in:
parent
5e94213f75
commit
d7923fa1cc
1 changed files with 8 additions and 2 deletions
10
custom.js
10
custom.js
|
@ -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();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue