agayn
This commit is contained in:
@@ -138,13 +138,11 @@
|
|||||||
transform: translateY(100%) translateY(-3px);
|
transform: translateY(100%) translateY(-3px);
|
||||||
}
|
}
|
||||||
|
|
||||||
.v0ck:hover .v0ck_player_controls,
|
|
||||||
.v0ck.v0ck_hover .v0ck_player_controls,
|
.v0ck.v0ck_hover .v0ck_player_controls,
|
||||||
.v0ck.v0ck_swf_active .v0ck_player_controls {
|
.v0ck.v0ck_swf_active .v0ck_player_controls {
|
||||||
transform: translateY(0);
|
transform: translateY(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
.v0ck:hover .v0ck_progress,
|
|
||||||
.v0ck.v0ck_hover .v0ck_progress,
|
.v0ck.v0ck_hover .v0ck_progress,
|
||||||
.v0ck.v0ck_swf_active .v0ck_progress {
|
.v0ck.v0ck_swf_active .v0ck_progress {
|
||||||
height: 8px;
|
height: 8px;
|
||||||
|
|||||||
@@ -111,10 +111,7 @@ class v0ck {
|
|||||||
setTimeout(() => parent.classList.remove("v0ck_no_transition"), 50);
|
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"]')) {
|
if (!document.querySelector('link[href^="/s/css/v0ck.css"]')) {
|
||||||
document.head.insertAdjacentHTML("beforeend", `<link rel="stylesheet" href="/s/css/v0ck.css">`); // inject css
|
document.head.insertAdjacentHTML("beforeend", `<link rel="stylesheet" href="/s/css/v0ck.css">`); // 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;
|
let controlsTimer;
|
||||||
function resetControlsTimer() {
|
function resetControlsTimer() {
|
||||||
if (!isMobile) return;
|
|
||||||
clearTimeout(controlsTimer);
|
clearTimeout(controlsTimer);
|
||||||
if (!video.paused) {
|
if (!video.paused) {
|
||||||
controlsTimer = setTimeout(() => {
|
controlsTimer = setTimeout(() => {
|
||||||
@@ -558,16 +554,26 @@ class v0ck {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isMobile) {
|
function showControlsAndReset() {
|
||||||
// Use capturing phase so we intercept events before child elements stop propagation
|
player.classList.add('v0ck_hover');
|
||||||
const resetEvents = ['touchstart', 'touchmove', 'touchend', 'click'];
|
resetControlsTimer();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Events that should show controls and reset/extend the auto-hide timer
|
||||||
|
const resetEvents = ['touchstart', 'touchmove', 'touchend', 'click', 'mousemove', 'mouseenter'];
|
||||||
resetEvents.forEach(evt => {
|
resetEvents.forEach(evt => {
|
||||||
player.addEventListener(evt, resetControlsTimer, { capture: true, passive: true });
|
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('play', resetControlsTimer);
|
||||||
video.addEventListener('playing', resetControlsTimer);
|
video.addEventListener('playing', resetControlsTimer);
|
||||||
video.addEventListener('pause', () => clearTimeout(controlsTimer));
|
video.addEventListener('pause', () => clearTimeout(controlsTimer));
|
||||||
}
|
|
||||||
|
|
||||||
this.toggleFullScreen = toggleFullScreen;
|
this.toggleFullScreen = toggleFullScreen;
|
||||||
this.enterFullScreen = enterFullScreen;
|
this.enterFullScreen = enterFullScreen;
|
||||||
|
|||||||
Reference in New Issue
Block a user