25 lines
589 B
Plaintext
25 lines
589 B
Plaintext
<script is:inline>
|
|
let colors = ["#24d05a", "#eb4888", "#10a2f5", "#e9bc3f"];
|
|
|
|
function getRandomColor() {
|
|
return colors[Math.floor(Math.random() * colors.length)];
|
|
}
|
|
|
|
function setRandomLinkColor() {
|
|
Array.from(document.getElementsByTagName("a")).forEach((e) => {
|
|
e.style.textDecorationColor = getRandomColor();
|
|
});
|
|
}
|
|
|
|
function setColorHoverListener() {
|
|
Array.from(document.querySelectorAll("a, button")).forEach((e) => {
|
|
e.addEventListener("mouseover", setRandomLinkColor);
|
|
});
|
|
}
|
|
|
|
(function () {
|
|
setRandomLinkColor();
|
|
setColorHoverListener();
|
|
})();
|
|
</script>
|