stalkers: pretty up code and remove useless rule

master
Aevann 2023-10-11 18:37:06 +03:00
parent a66d5ef174
commit 7c1c3f11ae
3 changed files with 8 additions and 11 deletions

View File

@ -1,13 +1,8 @@
body {
background: #000;
height: 100vh;
width: 100vw;
}
img.cursor-ghost {
img.cursor-stalker {
position: absolute;
height: 28px;
width: 28px;
background-repeat: no-repeat;
background-size: 100% auto;
z-index: 1000000000;
}

View File

@ -26,7 +26,9 @@ const assets = [
"marseynotesbardfinn"
];
const count = document.getElementById('stalker-count').value,
const stalker_container = document.getElementById("stalkers-container")
const count = parseInt(stalker_container.dataset.stalkersCount),
size = 25,
spacing = 4 - 0.05 * count,
diameter = 20 + 0.5 * count,
@ -54,9 +56,9 @@ function ghost(i) {
this.Y = 0;
this.img = document.createElement("img");
this.img.id = "ghost-" + i;
this.img.className = "cursor-ghost";
this.img.className = "cursor-stalker";
this.img.src = `${SITE_FULL_IMAGES}/e/${assets[i]}.webp`;
document.body.appendChild(this.img);
stalker_container.appendChild(this.img);
}
function placeghost(ghost, x, y) {

View File

@ -59,6 +59,6 @@
{% if p.award_count("stalker", v) %}
<link rel="stylesheet" href="{{'events/homoween/css/stalker.css' | asset}}">
<input hidden id="stalker-count" value="{{p.award_count('stalker', v)}}"></div>
<div id="stalkers-container" data-stalkers-count="{{p.award_count('stalker', v)}}"></div>
<script defer src="{{'events/homoween/js/stalker.js' | asset}}"></script>
{% endif %}