您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Hide the recommended videos section
- // ==UserScript==
- // @name Youtube: Hide Recommended Videos
- // @namespace https://github.com/Zren
- // @version 2
- // @description Hide the recommended videos section
- // @icon https://youtube.com/favicon.ico
- // @author Zren
- // @include http*://*.youtube.com/*
- // @include http*://youtube.com/*
- // @include http*://*.youtu.be/*
- // @include http*://youtu.be/*
- // @run-at document-start
- // ==/UserScript==
- //--- Utils
- function observe(selector, config, callback) {
- var observer = new MutationObserver(function(mutations) {
- mutations.forEach(function(mutation){
- callback(mutation);
- });
- });
- var target = document.querySelector(selector);
- observer.observe(target, config);
- return observer;
- }
- var documentLoaded = false;
- function tickUntilLoad(callback) {
- function tick() {
- callback();
- if (!documentLoaded) {
- window.requestAnimationFrame(tick);
- }
- }
- callback();
- window.requestAnimationFrame(tick);
- }
- function watchBodyForChanged(callback) {
- callback();
- observe('body', {
- attributes: true,
- }, function(mutation) {
- if (mutation.attributeName === 'class') {
- callback();
- }
- });
- }
- //---
- function getParent(e, selector) {
- var e2 = e.parentNode;
- while (e2) {
- if (e2.matches(selector)) {
- return e2;
- }
- e2 = e2.parentNode;
- }
- return null;
- }
- function hideSection(url) {
- var a = document.querySelector('.shelf-title-row a[href="' + url + '"]');
- if (a) {
- var section = getParent(a, '.item-section');
- section.style.display = 'none';
- }
- }
- function hideStuff() {
- hideSection("/feed/recommended");
- //hideSection("/feed/history"); // Watch it Again
- //hideSection("/user/IGNentertainment"); // IGN
- }
- tickUntilLoad(hideStuff);
- document.addEventListener('DOMContentLoaded', function(){
- documentLoaded = true;
- hideStuff();
- watchBodyForChanged(hideStuff);
- });
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址