From 867304bcb19014c0005a9b22896d4d36255046a1 Mon Sep 17 00:00:00 2001 From: Kibi Kelburton Date: Sat, 23 May 2026 09:44:38 +0200 Subject: [PATCH] agayn --- public/s/css/v0ck.css | 2 -- public/s/js/v0ck.js | 36 +++++++++++++++++++++--------------- 2 files changed, 21 insertions(+), 17 deletions(-) diff --git a/public/s/css/v0ck.css b/public/s/css/v0ck.css index 3c28d4d..5271fda 100644 --- a/public/s/css/v0ck.css +++ b/public/s/css/v0ck.css @@ -138,13 +138,11 @@ transform: translateY(100%) translateY(-3px); } -.v0ck:hover .v0ck_player_controls, .v0ck.v0ck_hover .v0ck_player_controls, .v0ck.v0ck_swf_active .v0ck_player_controls { transform: translateY(0); } -.v0ck:hover .v0ck_progress, .v0ck.v0ck_hover .v0ck_progress, .v0ck.v0ck_swf_active .v0ck_progress { height: 8px; diff --git a/public/s/js/v0ck.js b/public/s/js/v0ck.js index dd167d6..7a8b121 100644 --- a/public/s/js/v0ck.js +++ b/public/s/js/v0ck.js @@ -111,10 +111,7 @@ class v0ck { setTimeout(() => parent.classList.remove("v0ck_no_transition"), 50); } - if (!isMobile) { - parent.addEventListener('mouseenter', () => parent.classList.add("v0ck_hover")); - parent.addEventListener('mouseleave', () => parent.classList.remove("v0ck_hover")); - } + if (!document.querySelector('link[href^="/s/css/v0ck.css"]')) { document.head.insertAdjacentHTML("beforeend", ``); // inject css @@ -542,10 +539,9 @@ class v0ck { } } - // Mobile controls auto-hide logic (auto hide controls after 5 seconds of inactivity) + // Controls auto-hide logic (auto hide controls after 5 seconds of inactivity) let controlsTimer; function resetControlsTimer() { - if (!isMobile) return; clearTimeout(controlsTimer); if (!video.paused) { controlsTimer = setTimeout(() => { @@ -558,17 +554,27 @@ class v0ck { } } - if (isMobile) { - // Use capturing phase so we intercept events before child elements stop propagation - const resetEvents = ['touchstart', 'touchmove', 'touchend', 'click']; - resetEvents.forEach(evt => { - player.addEventListener(evt, resetControlsTimer, { capture: true, passive: true }); - }); - video.addEventListener('play', resetControlsTimer); - video.addEventListener('playing', resetControlsTimer); - video.addEventListener('pause', () => clearTimeout(controlsTimer)); + function showControlsAndReset() { + player.classList.add('v0ck_hover'); + resetControlsTimer(); } + // Events that should show controls and reset/extend the auto-hide timer + const resetEvents = ['touchstart', 'touchmove', 'touchend', 'click', 'mousemove', 'mouseenter']; + resetEvents.forEach(evt => { + player.addEventListener(evt, showControlsAndReset, { capture: true, passive: true }); + }); + + // Make sure leaving the player immediately hides the controls and clears the timer on desktop + player.addEventListener('mouseleave', () => { + player.classList.remove('v0ck_hover'); + clearTimeout(controlsTimer); + }, { capture: true, passive: true }); + + video.addEventListener('play', resetControlsTimer); + video.addEventListener('playing', resetControlsTimer); + video.addEventListener('pause', () => clearTimeout(controlsTimer)); + this.toggleFullScreen = toggleFullScreen; this.enterFullScreen = enterFullScreen;