From 7671e8c0cf78bbef10806856cebfcda678e7c7e9 Mon Sep 17 00:00:00 2001 From: Kibi Kelburton Date: Sun, 31 May 2026 12:14:43 +0200 Subject: [PATCH] gfds --- public/s/js/v0ck.js | 33 ++++++++++++++++++++++++++------- 1 file changed, 26 insertions(+), 7 deletions(-) diff --git a/public/s/js/v0ck.js b/public/s/js/v0ck.js index 50d7560..d5ace4b 100644 --- a/public/s/js/v0ck.js +++ b/public/s/js/v0ck.js @@ -177,11 +177,16 @@ class v0ck { // (mouse position is now tracked via docMouseX/docMouseY in resetControlsTimer block) function handleVolumeButton(vol) { - [...volumeSymbols].forEach(s => !s.classList.contains('v0ck_hidden') ? s.classList.add('v0ck_hidden') : null); - switch (true) { - case (vol === 0): [...volumeSymbols].filter(s => s.id === "v0ck_svg_volume_mute")[0].classList.toggle('v0ck_hidden'); break; - case (vol <= 0.5 && vol > 0): [...volumeSymbols].filter(s => s.id === "v0ck_svg_volume_mid")[0].classList.toggle('v0ck_hidden'); break; - case (vol > 0.5): [...volumeSymbols].filter(s => s.id === "v0ck_svg_volume_full")[0].classList.toggle('v0ck_hidden'); break; + [...volumeSymbols].forEach(s => s.classList.add('v0ck_hidden')); + let targetId = 'v0ck_svg_volume_full'; + if (vol === 0) { + targetId = 'v0ck_svg_volume_mute'; + } else if (vol <= 0.5) { + targetId = 'v0ck_svg_volume_mid'; + } + const activeSymbol = [...volumeSymbols].find(s => s.id === targetId); + if (activeSymbol) { + activeSymbol.classList.remove('v0ck_hidden'); } localStorage.setItem("volume", vol); } @@ -348,7 +353,10 @@ class v0ck { let icon = 'volume_full'; if (vol === 0) icon = 'volume_mute'; else if (vol <= 0.5) icon = 'volume_mid'; - hudIcon.setAttribute('href', `${hudIcon.getAttribute('href').split('#')[0]}#${icon}`); + + const baseSvg = (hudIcon.getAttribute('href') || hudIcon.getAttribute('xlink:href') || '/s/img/v0ck.svg').split('#')[0]; + hudIcon.setAttribute('href', `${baseSvg}#${icon}`); + hudIcon.setAttribute('xlink:href', `${baseSvg}#${icon}`); clearTimeout(hudTimer); hudTimer = setTimeout(() => hud.classList.add('v0ck_hidden'), 1000); @@ -367,7 +375,7 @@ class v0ck { startY = touch.clientY; startVol = video.volume; } - }, { passive: true }); + }, { passive: false }); player.addEventListener('touchmove', e => { if (!isMobile || !isRightSide || gestureType === 'other') return; @@ -410,7 +418,18 @@ class v0ck { }, { passive: false }); skipButtons.forEach(button => button.addEventListener('click', skip)); ranges.forEach(range => range.addEventListener('change', handleRangeUpdate)); + ranges.forEach(range => range.addEventListener('input', handleRangeUpdate)); ranges.forEach(range => range.addEventListener('mousemove', handleRangeUpdate)); + + // Prevent touch events on the volume slider from bubbling to the player container (avoiding gesture conflicts and page scrolls) + if (volumeSlider) { + ['touchstart', 'touchmove', 'touchend', 'touchcancel'].forEach(evt => { + volumeSlider.addEventListener(evt, e => { + e.stopPropagation(); + }, { passive: false }); + }); + } + progress.addEventListener('mousedown', scrub); progress.addEventListener('touchstart', scrub, { passive: false }); progress.addEventListener('touchmove', scrub, { passive: false });