From 0b3e49be94918cfd512e09046346dbb4d13dd615 Mon Sep 17 00:00:00 2001 From: Xevion Date: Sun, 10 Apr 2022 22:21:13 -0500 Subject: [PATCH] Move custom javascript into custom.js - May be affected by compressor layout --- _layouts/default.html | 15 +-------------- assets/js/custom.js | 12 ++++++++++++ 2 files changed, 13 insertions(+), 14 deletions(-) create mode 100644 assets/js/custom.js diff --git a/_layouts/default.html b/_layouts/default.html index 65952e5..db94380 100644 --- a/_layouts/default.html +++ b/_layouts/default.html @@ -55,20 +55,7 @@ layout: compress {% if page.layout == "posts" %} - + {% endif %} diff --git a/assets/js/custom.js b/assets/js/custom.js new file mode 100644 index 0000000..468fed6 --- /dev/null +++ b/assets/js/custom.js @@ -0,0 +1,12 @@ +window.onload = () => { + 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 = ''; + }) + } +} \ No newline at end of file