Youtube No-Recommendations

Remove Video Recommendations Completely

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         Youtube No-Recommendations
// @namespace    http://tampermonkey.net/
// @version      0.2
// @description  Remove Video Recommendations Completely 
// @author       BakaChan
// @match        https://*.youtube.com/*
// @grant        GM_getValue
// @grant        GM_setValue
// ==/UserScript==

///////////////////////////////////////////////////////////////////////
//                          YTPATCHES.JS                             //
///////////////////////////////////////////////////////////////////////

(function() {
    'use strict';

    const overrides = Object.create(null);

///////////////////////////////////////////////////////////////////////

    overrides['#related']=function(e){ e[0].remove(); };
    overrides['.videowall-endscreen']=function(e){ e[0].remove(); };
    overrides['[page-subtype="home"]']=function(e){ e[0].remove(); };
    overrides['.ytp-ce-element']=function(l){ l.forEach( e=>e.remove() ); };
    overrides['ytd-guide-entry-renderer > [href="/feed/trending"]']=function(e){ e[0].parentNode.remove(); };

///////////////////////////////////////////////////////////////////////

    const on_load = function(e){
        for( var [s,o] of Object.entries(overrides) )
            if((e=document.querySelectorAll(s)).length) o(e);
    };

    document.addEventListener('yt-navigate-finish',function(){ on_load(); setTimeout(on_load,2000); });
    on_load();
})();