From 34dbe04c9a1c184bd7e3529be890f96ad2ee2a78 Mon Sep 17 00:00:00 2001 From: Rasz_pl Date: Sat, 15 Jun 2024 16:22:45 +0200 Subject: [PATCH] Update player.js cleanup listeners after option switch --- js&css/web-accessible/www.youtube.com/player.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/js&css/web-accessible/www.youtube.com/player.js b/js&css/web-accessible/www.youtube.com/player.js index bd422bb42..76fa836fa 100644 --- a/js&css/web-accessible/www.youtube.com/player.js +++ b/js&css/web-accessible/www.youtube.com/player.js @@ -988,9 +988,7 @@ ImprovedTube.playerControls = function () { if (player && player.hideControls && player.showControls) { - if (hide === 'always') { - player.hideControls(); - } else if (hide === 'when_paused' && this.elements.video.paused) { + if (hide === 'when_paused' && this.elements.video.paused) { player.hideControls(); player.onmouseenter = player.showControls; @@ -1004,9 +1002,15 @@ ImprovedTube.playerControls = function () { thread = setTimeout(player.hideControls, 1000); }; })(); + return; + } else if (hide === 'always') { + player.hideControls(); } else { player.showControls(); } + player.onmouseenter = null; + player.onmouseleave = null; + player.onmousemove = null; } }; /*# HIDE VIDEO TITLE IN FULLSCREEN */ // Easier with CSS only (see player.css)