futtern/assets/javascript/emoji-footprint.js
lubiana a8db69786a
All checks were successful
/ ls (pull_request) Successful in 1m42s
/ ls (push) Successful in 1m38s
/ ls (release) Successful in 1m5s
add mono mode
2025-07-14 19:10:58 +02:00

24 lines
No EOL
907 B
JavaScript

// Sparkle effect on mouse move
document.addEventListener('mousemove', function (e) {
let emojis = ['✨', '💖', '🌟', '💅', '🦄', '🎉', '🌈'];
const htmlElement = document.documentElement;
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
}