futtern/assets/javascript/emoji-footprint.js
lubiana 0b4fe7f44a
Some checks failed
/ ls (pull_request) Failing after 25s
/ ls (release) Successful in 1m0s
/ ls (push) Successful in 1m36s
lol
2025-07-14 21:54:27 +02:00

27 lines
No EOL
1 KiB
JavaScript

// Sparkle effect on mouse move
document.addEventListener('mousemove', function (e) {
const htmlElement = document.documentElement;
if (htmlElement.getAttribute('data-website-mode') === 'normal') {
return;
}
let emojis = ['✨', '💖', '🌟', '💅', '🦄', '🎉', '🌈'];
if (htmlElement.getAttribute('data-website-mode') === 'mono') {
emojis = ['🦇', '🦉', '🦔', '🦡', '🐺', '', '', '', '', '', '', '', '', '', ''];
}
const sparkle = document.createElement('div');
sparkle.className = 'emoji-footprint';
sparkle.textContent = emojis[Math.floor(Math.random() * emojis.length)];
sparkle.style.left = e.pageX + 'px';
sparkle.style.top = e.pageY + 'px';
document.body.appendChild(sparkle);
setTimeout(() => {
sparkle.remove();
}, 1000);
});
export function initEmojiFootprint() {
// The sparkle effect is already initialized when this module is imported
// This function can be used if we need to control when the effect starts
}