mirror of
https://github.com/Xevion/v2.xevion.dev.git
synced 2025-12-08 06:08:55 -06:00
Move custom javascript into custom.js
- May be affected by compressor layout
This commit is contained in:
@@ -55,20 +55,7 @@ layout: compress
|
||||
<!-- Prevent FireFox from displaying FOUC with fake script tag. -->
|
||||
<script>0</script>
|
||||
{% if page.layout == "posts" %}
|
||||
<script>
|
||||
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 = '';
|
||||
})
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<script src="/assets/js/custom.js"></script>
|
||||
{% endif %}
|
||||
</head>
|
||||
<body>
|
||||
|
||||
12
assets/js/custom.js
Normal file
12
assets/js/custom.js
Normal file
@@ -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 = '';
|
||||
})
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user