Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 13 additions & 6 deletions Google/YoutubeHideNextVideos.user.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,17 @@
// @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
// @run-at document-idle
// @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
Expand All @@ -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%; }`)
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;}`)