4 ms·
Here is another one I found in my personal userscripts. I believe this script is more effective than my previous one because it prevents recommendations for Sh
by susam 8mo ago
Here is another one I found in my personal userscripts. I believe this script is more effective than my previous one because it prevents recommendations for Shorts or other videos from being shown.
// ==UserScript==
// @name No YT Sidebar and Shorts
// @match https://www.youtube.com/*
// ==/UserScript==
function noYTSidebar () {
const element = document.getElementById('secondary')
if (element === null) {
window.setTimeout(noYTSidebar, 1000)
return
}
element.getElementById('secondary').style.display = 'none'
}
function noYTShorts () {
const elements = document.querySelectorAll('ytd-rich-shelf-renderer')
if (elements.length === 0) {
window.setTimeout(noYTShorts, 1000)
return
}
for (e of document.querySelectorAll('ytd-rich-shelf-renderer')) {
e.style.display = 'none'
}
}
noYTSidebar()
noYTShorts()
- I_like_tomato 8mo agoThis is what I used, they have field `is-short`, https://github.com/epicseven-cup/remove-youtube-short/blob/main/src/content.ts#L3-L23 https://github.com/epicseven-cup/remove-youtube-short/blob/m... https://addons.mozilla.org/en-US/firefox/addon/remove-youtube-short/ https://addons.mozilla.org/en-US/firefox/addon/remove-youtub...
- susam 8mo agoThanks for sharing. I realised I have several userscripts I've written over time to tackle web browsing distractions. I found another one and this is probably the most effective for me because it hides Shorts at the CSS level. That means I don't need to rely on setTimeout(..., 1000) to catch elements that get inserted dynamically after the page loads. (function () { const css = ` #secondary { display: none } .ytd-rich-shelf-renderer { display: none } ` const style = document.createElement('style') style.textContent = css document.head.appendChild(style) })()
- ErenayDev 8mo agoI did a firefox addon 3 months ago. You can disable/enable things in addon menu. I'm using Study mode actively as I'm a student. https://github.com/ErenayDev/YouTube-Focus https://github.com/ErenayDev/YouTube-Focus