enhancement(lint): Fix lint errors for lib/jsscripts/oneko.ts

Co-authored-by: NeonGamerBot-QK <neon@saahild.com>
Signed-off-by: zeon-neon[bot] <136533918+zeon-neon[bot]@users.noreply.github.com>
This commit is contained in:
zeon-neon[bot] 2025-07-14 21:41:58 +00:00 committed by GitHub
parent 3d5d7d0d02
commit b0ac19a4f6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -3,7 +3,8 @@
// oneko.js: https://github.com/adryd325/oneko.js
export function injectOneko() {
const isReducedMotion = window.matchMedia(`(prefers-reduced-motion: reduce)`).matches === true;
const isReducedMotion =
window.matchMedia(`(prefers-reduced-motion: reduce)`).matches === true;
if (isReducedMotion) return;
@ -96,10 +97,10 @@ export function injectOneko() {
nekoEl.style.top = `${nekoPosY - 16}px`;
nekoEl.style.zIndex = "99999999";
let nekoFile = "https://saahild.com/oneko.gif"
const curScript = document.currentScript
let nekoFile = "https://saahild.com/oneko.gif";
const curScript = document.currentScript;
if (curScript && curScript.dataset.cat) {
nekoFile = curScript.dataset.cat
nekoFile = curScript.dataset.cat;
}
nekoEl.style.backgroundImage = `url(${nekoFile})`;
@ -124,8 +125,8 @@ export function injectOneko() {
lastFrameTimestamp = timestamp;
}
if (timestamp - lastFrameTimestamp > 100) {
lastFrameTimestamp = timestamp
frame()
lastFrameTimestamp = timestamp;
frame();
}
window.requestAnimationFrame(onAnimationFrame);
}
@ -206,9 +207,9 @@ export function injectOneko() {
const centerY = rect.top + rect.height / 2 + scrollTop;
for (let i = 0; i < 10; i++) {
const heart = document.createElement('div');
heart.className = 'heart';
heart.textContent = '❤';
const heart = document.createElement("div");
heart.className = "heart";
heart.textContent = "❤";
const offsetX = (Math.random() - 0.5) * 50;
const offsetY = (Math.random() - 0.5) * 50;
heart.style.left = `${centerX + offsetX - 16}px`;
@ -222,7 +223,7 @@ export function injectOneko() {
}
}
const style = document.createElement('style');
const style = document.createElement("style");
style.innerHTML = `
@keyframes heartBurst {
0% { transform: scale(0); opacity: 1; }
@ -238,7 +239,7 @@ export function injectOneko() {
`;
document.head.appendChild(style);
nekoEl.addEventListener('click', explodeHearts);
nekoEl.addEventListener("click", explodeHearts);
function frame() {
frameCount += 1;
@ -283,5 +284,5 @@ export function injectOneko() {
}
export function stopOneko() {
return document.getElementById('oneko')?.remove()
return document.getElementById("oneko")?.remove();
}