diff --git a/js&css/extension/init.js b/js&css/extension/init.js index 8c335f9da..54f84536f 100644 --- a/js&css/extension/init.js +++ b/js&css/extension/init.js @@ -44,7 +44,6 @@ extension.events.on('init', function () { extension.features.relatedVideos(); extension.features.comments(); extension.features.openNewTab(); - extension.features.hideVideoTitleFullScreen(); bodyReady(); }); diff --git a/js&css/extension/www.youtube.com/appearance/player/player.js b/js&css/extension/www.youtube.com/appearance/player/player.js index cb7a007f0..9cec10c6c 100644 --- a/js&css/extension/www.youtube.com/appearance/player/player.js +++ b/js&css/extension/www.youtube.com/appearance/player/player.js @@ -7,24 +7,6 @@ /*-------------------------------------------------------------- # --------------------------------------------------------------*/ - - /*-------------------------------------------------------------- # HIDE VIDEO TITLE IN FULLSCREEN --------------------------------------------------------------*/ - -extension.features.hideVideoTitleFullScreen = function (){ - document.addEventListener('fullscreenchange', function (){ - if(document.fullscreenElement){ - const youtubeTitle = document.querySelector(".ytp-title-text > a"); - - if(youtubeTitle){ - if (extension.storage.get("hide_video_title_fullScreen") === true) { - youtubeTitle.style.display = "none"; - }else{ - youtubeTitle.style.display = "block"; - } - } - } - }); -} \ No newline at end of file diff --git a/js&css/web-accessible/core.js b/js&css/web-accessible/core.js index 8c3c9c848..3a1ef24bb 100644 --- a/js&css/web-accessible/core.js +++ b/js&css/web-accessible/core.js @@ -259,6 +259,9 @@ document.addEventListener('it-message-from-extension', function () { } else if ( camelized_key === 'playerRemainingDuration' ) { if (ImprovedTube.storage.player_remaining_duration === false) {document.querySelector(".ytp-time-remaining-duration")?.remove();} if (ImprovedTube.storage.player_remaining_duration === true) { ImprovedTube.playerRemainingDuration(); } + } else if ( camelized_key === 'hideVideoTitleFullScreen' ) { + if (ImprovedTube.storage.hide_video_title_fullScreen === false) {document.querySelector(".ytp-title-text > a")?.style.setProperty('display', 'block');} + if (ImprovedTube.storage.hide_video_title_fullScreen === true) {document.querySelector(".ytp-title-text > a")?.style.setProperty('display', 'none'); } } if (ImprovedTube[camelized_key]) { try{ImprovedTube[camelized_key]()}catch{}; diff --git a/js&css/web-accessible/functions.js b/js&css/web-accessible/functions.js index ca098f512..e8a72582e 100644 --- a/js&css/web-accessible/functions.js +++ b/js&css/web-accessible/functions.js @@ -363,6 +363,7 @@ ImprovedTube.initPlayer = function () { ImprovedTube.playerFitToWinButton(); ImprovedTube.playerHamburgerButton(); ImprovedTube.playerControls(); + ImprovedTube.hideVideoTitleFullScreen(); setTimeout(function () { ImprovedTube.forcedTheaterMode(); diff --git a/js&css/web-accessible/www.youtube.com/player.js b/js&css/web-accessible/www.youtube.com/player.js index 0d8ec9776..ff7cbbdff 100644 --- a/js&css/web-accessible/www.youtube.com/player.js +++ b/js&css/web-accessible/www.youtube.com/player.js @@ -848,6 +848,13 @@ ImprovedTube.playerControls = function (pause=false) { }} else { player.showControls(); } } }; +/*-------------------------------------------------------------- +# HIDE VIDEO TITLE IN FULLSCREEN +--------------------------------------------------------------*/ +ImprovedTube.hideVideoTitleFullScreen = function (){ if (ImprovedTube.storage.hide_video_title_fullScreen === true) { + document.addEventListener('fullscreenchange', function (){ document.querySelector(".ytp-title-text > a")?.style.setProperty('display', 'none'); + }) +}}; /*------------------------------------------------------------------------------ CUSTOM MINI-PLAYER ------------------------------------------------------------------------------*/