Files
v2.xevion.dev/assets/js/custom.js
Xevion 28b2062bfc Fix commit hex color hover breaking with glitch effect onLoad override
The new glitch effect session storage management was overriding window.onload,
breaking the commit color hover's onload override. I should probably use addEventListener
for both of them, but I'm busy, I just want it fixed now so I can sleep.
2022-11-14 01:52:50 -06:00

14 lines
513 B
JavaScript

// Easter egg feature! 🐣️
setupCommitHover = () => {
let commit = document.querySelector("#commit-id > a");
if (commit != null) {
let colorCode = commit.innerHTML.trim().substring(1, 7);
commit.addEventListener('mouseover', function handler() {
commit.style.color = `#${colorCode}`;
})
commit.addEventListener('mouseout', function handler() {
commit.style.color = '';
})
}
};
window.addEventListener("load", setupCommitHover, true);