gfds
This commit is contained in:
@@ -177,11 +177,16 @@ class v0ck {
|
|||||||
// (mouse position is now tracked via docMouseX/docMouseY in resetControlsTimer block)
|
// (mouse position is now tracked via docMouseX/docMouseY in resetControlsTimer block)
|
||||||
|
|
||||||
function handleVolumeButton(vol) {
|
function handleVolumeButton(vol) {
|
||||||
[...volumeSymbols].forEach(s => !s.classList.contains('v0ck_hidden') ? s.classList.add('v0ck_hidden') : null);
|
[...volumeSymbols].forEach(s => s.classList.add('v0ck_hidden'));
|
||||||
switch (true) {
|
let targetId = 'v0ck_svg_volume_full';
|
||||||
case (vol === 0): [...volumeSymbols].filter(s => s.id === "v0ck_svg_volume_mute")[0].classList.toggle('v0ck_hidden'); break;
|
if (vol === 0) {
|
||||||
case (vol <= 0.5 && vol > 0): [...volumeSymbols].filter(s => s.id === "v0ck_svg_volume_mid")[0].classList.toggle('v0ck_hidden'); break;
|
targetId = 'v0ck_svg_volume_mute';
|
||||||
case (vol > 0.5): [...volumeSymbols].filter(s => s.id === "v0ck_svg_volume_full")[0].classList.toggle('v0ck_hidden'); break;
|
} 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);
|
localStorage.setItem("volume", vol);
|
||||||
}
|
}
|
||||||
@@ -348,7 +353,10 @@ class v0ck {
|
|||||||
let icon = 'volume_full';
|
let icon = 'volume_full';
|
||||||
if (vol === 0) icon = 'volume_mute';
|
if (vol === 0) icon = 'volume_mute';
|
||||||
else if (vol <= 0.5) icon = 'volume_mid';
|
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);
|
clearTimeout(hudTimer);
|
||||||
hudTimer = setTimeout(() => hud.classList.add('v0ck_hidden'), 1000);
|
hudTimer = setTimeout(() => hud.classList.add('v0ck_hidden'), 1000);
|
||||||
@@ -367,7 +375,7 @@ class v0ck {
|
|||||||
startY = touch.clientY;
|
startY = touch.clientY;
|
||||||
startVol = video.volume;
|
startVol = video.volume;
|
||||||
}
|
}
|
||||||
}, { passive: true });
|
}, { passive: false });
|
||||||
|
|
||||||
player.addEventListener('touchmove', e => {
|
player.addEventListener('touchmove', e => {
|
||||||
if (!isMobile || !isRightSide || gestureType === 'other') return;
|
if (!isMobile || !isRightSide || gestureType === 'other') return;
|
||||||
@@ -410,7 +418,18 @@ class v0ck {
|
|||||||
}, { passive: false });
|
}, { passive: false });
|
||||||
skipButtons.forEach(button => button.addEventListener('click', skip));
|
skipButtons.forEach(button => button.addEventListener('click', skip));
|
||||||
ranges.forEach(range => range.addEventListener('change', handleRangeUpdate));
|
ranges.forEach(range => range.addEventListener('change', handleRangeUpdate));
|
||||||
|
ranges.forEach(range => range.addEventListener('input', handleRangeUpdate));
|
||||||
ranges.forEach(range => range.addEventListener('mousemove', 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('mousedown', scrub);
|
||||||
progress.addEventListener('touchstart', scrub, { passive: false });
|
progress.addEventListener('touchstart', scrub, { passive: false });
|
||||||
progress.addEventListener('touchmove', scrub, { passive: false });
|
progress.addEventListener('touchmove', scrub, { passive: false });
|
||||||
|
|||||||
Reference in New Issue
Block a user