diff --git a/Google/YoutubeHideNextVideos.user.js b/Google/YoutubeHideNextVideos.user.js index eed0f8f..e358e77 100644 --- a/Google/YoutubeHideNextVideos.user.js +++ b/Google/YoutubeHideNextVideos.user.js @@ -2,8 +2,8 @@ // @name YouTube Hide Next Videos // @namespace https://github.com/mkazin/OhMonkey // @author Michael Kazin -// @version 1.1 -// @description Removes YouTube's algorithm suggestions. Also shades watched videos. +// @version 1.2 +// @description Removes YouTube's algorithm suggestions. And ads. Also darkens watched videos. // @license BSD-3-Clause // @match https://*.youtube.com/* // @icon https://www.google.com/s2/favicons?sz=64&domain=youtube.com @@ -11,7 +11,8 @@ // @grant GM_addStyle // ==/UserScript== -const SELECTORS = [ + +const SELECTORS_TO_HIDE = [ // Next-video thumbnails shown when approaching end of playback "div.ytp-ce-element", // "Video Wall" shown when video is over @@ -20,7 +21,13 @@ const SELECTORS = [ "div#related", ] -GM_addStyle(`${SELECTORS.join(",")} { display:none; }`) +GM_addStyle(`${SELECTORS_TO_HIDE.join(",")} { display:none; }`) + +// Shade video thumbnails with a full progress bar (or nearly full) +GM_addStyle(`div#thumbnail:has(div#progress[style="width: 100%;"]) { opacity: 15%; }`) +GM_addStyle(`div#thumbnail:has(div#progress[style*="width: 9;"]) { opacity: 15%; }`) -// Shades video thumbnails with a full progress bar -GM_addStyle(`div#thumbnail:has(div#progress[style="width: 100%;"]) { opacity: 20%; }`) \ No newline at end of file +const VIDEO_CARD_SELECTOR = "ytd-rich-item-renderer" +const SPONSORED_TEXT_SELECTOR = "ad-badge-view-model" +const SPONSORED_RENDER_SELECTOR = "ytd-ad-slot-renderer" +GM_addStyle(`${VIDEO_CARD_SELECTOR}:has(${SPONSORED_TEXT_SELECTOR}),${VIDEO_CARD_SELECTOR}:has(${SPONSORED_RENDER_SELECTOR}) { display: none;}`)