No Relevant Subscriptions Tab

Hides and removes the Most relevant shelf from YouTube subscriptions feed.

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey, Greasemonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

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

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

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

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्क्रिप्ट व्यवस्थापक एक्स्टेंशन इंस्टॉल करावे लागेल.

(माझ्याकडे आधीच युझर स्क्रिप्ट व्यवस्थापक आहे, मला इंस्टॉल करू द्या!)

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

(माझ्याकडे आधीच युझर स्टाईल व्यवस्थापक आहे, मला इंस्टॉल करू द्या!)

// ==UserScript==
// @name         No Relevant Subscriptions Tab
// @license      MIT
// @namespace    https://youtube.com/
// @version      1.0
// @description  Hides and removes the Most relevant shelf from YouTube subscriptions feed.
// @author       BergNetworks
// @match        https://www.youtube.com/feed/subscriptions
// @match        https://youtube.com/feed/subscriptions
// @run-at       document-start
// @grant        none
// @icon         data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMDAiIGhlaWdodD0iMjAwIiB2aWV3Qm94PSIwIDAgMTAyNCA3NjgiIGZpbGw9IiMwMDAwMDAiPjxwYXRoIGZpbGw9IiMwMDAwMDAiIGQ9Ik05MjggNzM2cS0yMjIgMzItNDE2IDMycS04NiAwLTE5MC04dC0xNjUtMTZsLTYxLThxLTI3LTUtNDcuNS0zNy41dC0zMC03OC41dC0xNC04NlQwIDQ2MVYzMDdRMCA1MiA5NiAzMlEzMTggMCA1MTIgMHE4NiAwIDE5MCA4dDE2NSAxNmw2MSA4cTI5IDQgNDkuNSAzNi41VDEwMDcgMTQ4dDEzIDg2dDQgNzN2MTU0cTAgMzYtMyA3M3QtMTIgODV0LTMwIDgwdC01MSAzN3pNNjkzIDM1OUw0MzEgMTk5cS0xMS0xMC0yOS01LjVUMzg0IDIwOHYzNTJxMCAxMSAxOCAxNXQyOS02bDI2Mi0xNjBxMTEtMTAgMTEtMjV0LTExLTI1eiIvPjwvc3ZnPg==
// ==/UserScript==

(function () {
    'use strict';

    function isSubscriptionsPage() {
        return location.hostname.endsWith('youtube.com') &&
               location.pathname === '/feed/subscriptions';
    }

    function injectCss() {
        const style = document.createElement('style');
        style.textContent = `
            ytd-rich-section-renderer:has(ytd-rich-shelf-renderer #title)
            {
            }

            ytd-rich-section-renderer:has(ytd-rich-shelf-renderer #title),
            ytd-rich-section-renderer:has(span#title)
            {
            }
        `;
        document.documentElement.appendChild(style);
    }

    function removeMostRelevantShelves() {
        if (!isSubscriptionsPage()) return;

        const sections = document.querySelectorAll('ytd-rich-section-renderer');

        for (const section of sections) {
            const title = section.querySelector('#title');
            if (!title) continue;

            const text = (title.textContent || '').trim();
            if (text === 'Most relevant') {
                section.remove();
            }
        }
    }

    function startObserver() {
        const observer = new MutationObserver(() => {
            removeMostRelevantShelves();
        });

        observer.observe(document.documentElement, {
            childList: true,
            subtree: true
        });

        removeMostRelevantShelves();
    }

    function init() {
        if (!isSubscriptionsPage()) return;
        injectCss();
        removeMostRelevantShelves();
        startObserver();
    }

    window.addEventListener('yt-navigate-finish', init);
    window.addEventListener('load', init);
    init();
})();