diff --git a/_locales/en/messages.json b/_locales/en/messages.json index 8292dbb2f..570e64bac 100644 --- a/_locales/en/messages.json +++ b/_locales/en/messages.json @@ -650,6 +650,9 @@ "hideHomePageShorts": { "message": "Hide Shorts on the home page" }, + "hideIncludesPaidPromotion": { + "message": "Hide \"Includes Paid Promotion\"" + }, "hideMore": { "message": "Hide '...'" }, diff --git a/js&css/extension/www.youtube.com/appearance/player/player.css b/js&css/extension/www.youtube.com/appearance/player/player.css index d1703a6b9..dca45f783 100644 --- a/js&css/extension/www.youtube.com/appearance/player/player.css +++ b/js&css/extension/www.youtube.com/appearance/player/player.css @@ -7,6 +7,7 @@ # Hide annotations # Hide endscreen # Hide cards +# Hide "Includes Paid Promotion" # Show cards on mouse hover # Hide "Scroll for details" # Player Size @@ -626,3 +627,39 @@ html[data-page-type=video][it-hide-top-loading-bar=true] .ytp-load-progress, html[data-page-type=video][it-hide-top-loading-bar=true] .ytp-loading-bar { display: none !important; } + +/*-------------------------------------------------------------- +# HIDE PROGRESS BAR PREVIEW +--------------------------------------------------------------*/ +html[data-page-type=video][it-hide-progress-preview='true'] .ytp-preview, +html[data-page-type=video][it-hide-progress-preview='true'] .ytp-tooltip, +html[data-page-type=video][it-hide-progress-preview='true'] .ytp-tooltip-bg, +html[data-page-type=video][it-hide-progress-preview='true'] .ytp-tooltip-text, +html[data-page-type=video][it-hide-progress-preview='true'] .ytp-tooltip-text-wrapper, +html[data-page-type=video][it-hide-progress-preview='true'] .ytp-chapter-hover-container { + display: none !important; + opacity: 0 !important; + visibility: hidden !important; + pointer-events: none !important; +} + +/*-------------------------------------------------------------- +# HIDE "SCROLL FOR DETAILS" +--------------------------------------------------------------*/ + +html[it-hide-scroll-for-details='true'] button.ytp-fullerscreen-edu-button { + display: none !important; +} + +html[it-hide-scroll-for-details='true'] ytd-app[scrolling_] { + overflow: hidden !important; +} + +/*-------------------------------------------------------------- +# HIDE Includes Paid Promotion +--------------------------------------------------------------*/ +html[data-page-type=video][it-hide-includes-paid-promotion=true] .ytp-paid-content-overlay, +html[data-page-type=home][it-hide-includes-paid-promotion=true] .YtmPaidContentOverlayLink, +html[data-page-type=other][it-hide-includes-paid-promotion=true] .YtmPaidContentOverlayLink { + display: none !important; +} diff --git a/js&css/extension/www.youtube.com/styles.css b/js&css/extension/www.youtube.com/styles.css index 1ecc02214..3711aedeb 100644 --- a/js&css/extension/www.youtube.com/styles.css +++ b/js&css/extension/www.youtube.com/styles.css @@ -683,6 +683,7 @@ html:not([data-page-type=channel]) .it-blocklisted-channel:hover ytd-thumbnail { color: var(--paper-tooltip-text-color, white); border-radius: 2px; background-color: var(--paper-tooltip-background, #616161); + z-index: 1002; } /*------------------------------------------------------------------------------ diff --git a/js&css/web-accessible/core.js b/js&css/web-accessible/core.js index 9fcfd69b3..8b167a2df 100644 --- a/js&css/web-accessible/core.js +++ b/js&css/web-accessible/core.js @@ -302,6 +302,14 @@ document.addEventListener('it-message-from-extension', function () { } break + case 'playerCinemaModeButton' : + if (ImprovedTube.storage.player_cinema_mode_button === false) { + if (ImprovedTube.elements.buttons['it-cinema-mode-button']) { + ImprovedTube.elements.buttons['it-cinema-mode-button']?.remove(); + ImprovedTube.elements.buttons['it-cinema-mode-styles']?.remove(); + } + } + case 'playerRepeatButton': if (ImprovedTube.storage.player_repeat_button === false) { if (ImprovedTube.elements.buttons['it-repeat-button']) { @@ -397,6 +405,10 @@ document.addEventListener('it-message-from-extension', function () { ImprovedTube.subtitlesUserSettings(); break + case 'playerHideProgressPreview': + ImprovedTube.playerHideProgressPreview(); + break + case 'playerHideControls': ImprovedTube.playerControls(); break diff --git a/js&css/web-accessible/functions.js b/js&css/web-accessible/functions.js index 360ba4357..a54cbd166 100644 --- a/js&css/web-accessible/functions.js +++ b/js&css/web-accessible/functions.js @@ -344,6 +344,7 @@ ImprovedTube.initPlayer = function () { ImprovedTube.playerFitToWinButton(); ImprovedTube.playerHamburgerButton(); ImprovedTube.playerControls(); + ImprovedTube.playerHideProgressPreview(); ImprovedTube.expandDescription(); setTimeout(function () {ImprovedTube.forcedTheaterMode(); }, 150); if (location.href.indexOf('/embed/') === -1) { ImprovedTube.miniPlayer(); } @@ -415,6 +416,31 @@ if (document.documentElement.dataset.pageType === 'video' } } +/*-------------------------------------------------------------- +# HIDE PROGRESS BAR PREVIEW +--------------------------------------------------------------*/ + +ImprovedTube.playerHideProgressPreview = function () { + const shouldHide = this.storage.player_hide_progress_preview === true; + + if (shouldHide) { + document.documentElement.setAttribute('it-hide-progress-preview', 'true'); + + // Force refresh the player UI + if (this.elements.player) { + this.elements.player.dispatchEvent(new Event('mousemove')); + // Also try to force hide any existing tooltips + const tooltips = document.querySelectorAll('.ytp-tooltip, .ytp-preview, .ytp-tooltip-text-wrapper'); + tooltips.forEach(tooltip => { + tooltip.style.display = 'none'; + tooltip.style.opacity = '0'; + tooltip.style.visibility = 'hidden'; + }); + } + } else { + document.documentElement.removeAttribute('it-hide-progress-preview'); + } +}; ImprovedTube.playerOnEnded = function (event) { ImprovedTube.playlistUpNextAutoplay(event); diff --git a/js&css/web-accessible/www.youtube.com/player.js b/js&css/web-accessible/www.youtube.com/player.js index f74c8c326..8491f7fe4 100644 --- a/js&css/web-accessible/www.youtube.com/player.js +++ b/js&css/web-accessible/www.youtube.com/player.js @@ -847,7 +847,6 @@ ImprovedTube.playerFitToWinButton = function () { /*------------------------------------------------------------------------------ CINEMA MODE BUTTON ------------------------------------------------------------------------------*/ - var xpath = function (xpathToExecute) { var result = []; var nodesSnapshot = document.evaluate(xpathToExecute, document, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null ); @@ -1146,10 +1145,7 @@ ImprovedTube.miniPlayer_scroll = function () { ImprovedTube.mini_player__setSize(ImprovedTube.mini_player__width, ImprovedTube.mini_player__height, true, true); - window.addEventListener('mousedown', ImprovedTube.miniPlayer_mouseDown); - window.addEventListener('mousemove', ImprovedTube.miniPlayer_cursorUpdate); - - window.dispatchEvent(new Event('resize')); + window.addEventListener('resize', ImprovedTube.miniPlayer_scroll); } else if (window.scrollY < 256 && ImprovedTube.mini_player__mode === true || ImprovedTube.elements.player.classList.contains('ytp-player-minimized') === true) { ImprovedTube.mini_player__mode = false; ImprovedTube.elements.player.classList.remove('it-mini-player'); @@ -1161,10 +1157,14 @@ ImprovedTube.miniPlayer_scroll = function () { ImprovedTube.mini_player__cursor = ''; document.documentElement.removeAttribute('it-mini-player-cursor'); + window.dispatchEvent(new Event('resize')); + window.removeEventListener('mousedown', ImprovedTube.miniPlayer_mouseDown); + window.removeEventListener('mousemove', ImprovedTube.miniPlayer_mouseMove); + window.removeEventListener('mouseup', ImprovedTube.miniPlayer_mouseUp); + window.removeEventListener('click', ImprovedTube.miniPlayer_click); + window.removeEventListener('scroll', ImprovedTube.miniPlayer_scroll); window.removeEventListener('mousemove', ImprovedTube.miniPlayer_cursorUpdate); - - window.dispatchEvent(new Event('resize')); } }; @@ -1513,3 +1513,14 @@ ImprovedTube.pauseWhileTypingOnYoutube = function () { } }; + +/*------------------------------------------------------------------------------ +HIDE PROGRESS BAR PREVIEW +------------------------------------------------------------------------------*/ +ImprovedTube.playerHideProgressPreview = function () { + if (this.storage.player_hide_progress_preview === true) { + document.documentElement.setAttribute('it-hide-progress-preview', 'true'); + } else { + document.documentElement.removeAttribute('it-hide-progress-preview'); + } +}; diff --git a/menu/index.html b/menu/index.html index f2df9ac2a..9d7e5b4e6 100644 --- a/menu/index.html +++ b/menu/index.html @@ -35,4 +35,4 @@