From e971a3d7ab7e1aec52c78098f05167f5ee1f5f48 Mon Sep 17 00:00:00 2001 From: cybrneko Date: Sat, 10 May 2025 22:20:36 -0500 Subject: [PATCH] experimental mobile touchscreen support for oneko --- searx/static/themes/simple/js/oneko.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/searx/static/themes/simple/js/oneko.js b/searx/static/themes/simple/js/oneko.js index 4dc890775..6c3754e6e 100644 --- a/searx/static/themes/simple/js/oneko.js +++ b/searx/static/themes/simple/js/oneko.js @@ -105,11 +105,19 @@ document.body.appendChild(nekoEl); - document.addEventListener("mousemove", function (event) { + // Attach event listeners for both desktop and mobile + document.addEventListener('mousemove', function (event) { mousePosX = event.clientX; mousePosY = event.clientY; }); + document.addEventListener('touchmove', function (event) { + // Use the first touch point (primary touch) + const touch = event.touches[0]; + mousePosX = touch.clientX; + mousePosY = touch.clientY; + }, { passive: false }); // Allow preventing default if needed + window.requestAnimationFrame(onAnimationFrame); }