You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// Function to hide elements with specific selectors
function hideShorts() {
const shortsSelectors = [
'ytd-rich-section-renderer[header-style="SHORTS"]', // Shorts section on homepage
'ytd-grid-video-renderer[is-shorts]', // Shorts in subscription feed
'ytd-reel-shelf-renderer' // Shorts in explore
];
shortsSelectors.forEach(selector => {
const elements = document.querySelectorAll(selector);
elements.forEach(element => {
element.style.display = 'none';
});
});
}
// Run the function initially
hideShorts();
// Create a MutationObserver to watch for changes and hide Shorts dynamically
const observer = new MutationObserver(hideShorts);
observer.observe(document.body, { childList: true, subtree: true });
})();
The text was updated successfully, but these errors were encountered:
// ==UserScript==
// @name Hide YouTube Shorts
// @namespace http://tampermonkey.net/
// @Version 0.1
// @description Hide YouTube Shorts on YouTube
// @author Your Name
// @match https://www.youtube.com/*
// @grant none
// ==/UserScript==
(function() {
'use strict';
})();
The text was updated successfully, but these errors were encountered: