Compare commits

...

2 Commits

Author SHA1 Message Date
869ee77446
Merge branch 'main' into feature/admin
Some checks failed
.NET / Build & Test (push) Failing after 46s
2024-03-02 05:32:45 +00:00
5fae03b483
fix: null check headshot
All checks were successful
.NET / Build & Test (push) Successful in 1m29s
2024-03-02 05:32:34 +00:00

View File

@ -107,31 +107,33 @@ declare const Prism: any;
let avatarType = 0;
const headshot = document.getElementById("index-headshot") as HTMLImageElement;
headshot.addEventListener("click", (ev: MouseEvent) => {
if (avatarType === 0) {
headshot.classList.add("headshot-spin", "headshot-spin-start");
setTimeout(() => {
headshot.classList.remove("headshot-spin-start");
headshot.src = "/img/avatar_512x512.jpg"
headshot.classList.add("headshot-spin", "headshot-spin-end");
if (headshot) {
headshot.addEventListener("click", (ev: MouseEvent) => {
if (avatarType === 0) {
headshot.classList.add("headshot-spin", "headshot-spin-start");
setTimeout(() => {
headshot.classList.remove("headshot-spin", "headshot-spin-end");
avatarType = 1;
}, 800);
}, 400);
} else if (avatarType === 1) {
headshot.classList.add("headshot-spin", "headshot-spin-start");
setTimeout(() => {
headshot.classList.remove("headshot-spin-start");
headshot.src = "/img/headshot_512x512_2023.jpg"
headshot.classList.add("headshot-spin", "headshot-spin-end");
headshot.classList.remove("headshot-spin-start");
headshot.src = "/img/avatar_512x512.jpg"
headshot.classList.add("headshot-spin", "headshot-spin-end");
setTimeout(() => {
headshot.classList.remove("headshot-spin", "headshot-spin-end");
avatarType = 1;
}, 800);
}, 400);
} else if (avatarType === 1) {
headshot.classList.add("headshot-spin", "headshot-spin-start");
setTimeout(() => {
headshot.classList.remove("headshot-spin", "headshot-spin-end");
avatarType = 0;
}, 800);
}, 400);
}
});
headshot.classList.remove("headshot-spin-start");
headshot.src = "/img/headshot_512x512_2023.jpg"
headshot.classList.add("headshot-spin", "headshot-spin-end");
setTimeout(() => {
headshot.classList.remove("headshot-spin", "headshot-spin-end");
avatarType = 0;
}, 800);
}, 400);
}
});
}
})();