mirror of
https://github.com/Xevion/v2.xevion.dev.git
synced 2025-12-11 04:09:03 -06:00
Colorize the commit ID text on hover
It's fun to add little secrets to my website.
This commit is contained in:
@@ -54,6 +54,20 @@ layout: compress
|
|||||||
</style>
|
</style>
|
||||||
<!-- Prevent FireFox from displaying FOUC with fake script tag. -->
|
<!-- Prevent FireFox from displaying FOUC with fake script tag. -->
|
||||||
<script>0</script>
|
<script>0</script>
|
||||||
|
{% if page.layout == "posts" %}
|
||||||
|
<script>
|
||||||
|
window.onload = () => {
|
||||||
|
let commit = document.querySelector("#commit-id > a");
|
||||||
|
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 = '';
|
||||||
|
})
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
{% endif %}
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<header>Ryan Walters</header>
|
<header>Ryan Walters</header>
|
||||||
|
|||||||
Reference in New Issue
Block a user