Block YouTube Shorts Completely

Hides YT Shorts (I use this to focus better on my work)

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Greasemonkey lub Violentmonkey.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana będzie instalacja rozszerzenia Tampermonkey lub Userscripts.

You will need to install an extension such as Tampermonkey to install this script.

Aby zainstalować ten skrypt, musisz zainstalować rozszerzenie menedżera skryptów użytkownika.

(Mam już menedżera skryptów użytkownika, pozwól mi to zainstalować!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Musisz zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

(Mam już menedżera stylów użytkownika, pozwól mi to zainstalować!)

// ==UserScript==
// @name                Block YouTube Shorts Completely
// @namespace    http://tampermonkey.net/
// @version            2.0
// @description    Hides YT Shorts (I use this to focus better on my work)
// @author             Emree.el on instagram 
// @match             https://www.youtube.com/*
// @grant               none
// @license           MIT
// ==/UserScript==

(function() {
    'use strict';

    const removeShorts = () => {
        const selectors = [
            'ytd-rich-shelf-renderer:has(a[href^="/shorts"])',
            'ytd-reel-shelf-renderer',
            'a[href^="/shorts"]',
            'ytd-grid-video-renderer:has(a[href^="/shorts"])',
            'ytd-reel-item-renderer',
            'ytd-video-renderer:has(a[href*="shorts"])',
            'a[title="Shorts"]', // Sidebar Shorts button
            'a[href="/shorts"]'   // Any other direct shorts button
        ];

        selectors.forEach(selector => {
            document.querySelectorAll(selector).forEach(el => el.remove());
        });
    };

    setInterval(removeShorts, 1000); // run every second to clean up
})();