您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
YouTube - Remove YouTube shorts from subscriptions list
当前为
// ==UserScript== // @name YouTube - Remove YouTube shorts from subscriptions // @namespace Violentmonkey Scripts // @match *://www.youtube.com/* // @version 1.0 // @author jez9999 // @description YouTube - Remove YouTube shorts from subscriptions list // @require https://code.jquery.com/jquery-3.6.0.min.js // @grant none // @license MIT // ==/UserScript== (function() { 'use strict'; // ******************** // Reminder: set the following in Violentmonkey advanced settings for Editor: // "tabSize": 4, // "autoCloseBrackets": false, // // Also, bear in mind there appears to be a bug in Violentmonkey where after a while, MutationObserver's // stop being debuggable and the whole browser needs restarting before it'll work again. // ******************** var utils = {}; utils.jq = jQuery.noConflict( true ); utils.isUnspecified = function(input) { return ((typeof input === "undefined") || (input === null)); } utils.isSpecified = function(input) { return ((typeof input !== "undefined") && (input !== null)); } // Add 'hidden renderer' class var sheet = document.createElement('style'); sheet.innerHTML = ".hiddenRenderer {display: none!important;}"; document.body.appendChild(sheet); // Observe DOM mutations for when 'shorts' video renderer is added and whenever it is, hide it var config = { attributes: true, attributeOldValue: true, childList: true, characterData: true, subtree: true }; var observer = new MutationObserver(function(mutations) { mutations.forEach(function(mutation) { let $mTarget = utils.jq(mutation.target); let mTargetTagName = $mTarget.prop("tagName"); // Upon unhiding of subscriptions browse panel, recursively hide all 'shorts' overlays (looks like they can be added sometimes and we miss them) if ( mTargetTagName && mTargetTagName.toLowerCase() == "ytd-browse" && $mTarget.attr("page-subtype") == "subscriptions" && mutation.type == "attributes" && mutation.attributeName == "hidden" && utils.isSpecified(mutation.oldValue) && utils.isUnspecified($mTarget.attr("hidden")) ) { $mTarget.find('ytd-thumbnail-overlay-time-status-renderer[overlay-style="SHORTS"]').each(function(){ // Travel up to video-renderer parent and hide it utils.jq(this).parents('ytd-grid-video-renderer').addClass('hiddenRenderer'); }); } // Also, when new nodes are straight-up added, hide 'shorts' overlays when they're found else if (mutation.addedNodes && mutation.addedNodes.length > 0) { [].forEach.call(mutation.addedNodes, function(el) { // YouTube first creates the video-renderer, then tacks on the 'shorts' overlay; so instead of finding the mutation that adds // the video-renderer, we find the mutation that adds on the 'shorts' overlay, then travel up to its video-renderer parent, // and hide it at that point. var $addedNode = utils.jq(el); var tagName = $addedNode.prop("tagName"); if (tagName && tagName.toLowerCase() == 'ytd-thumbnail-overlay-time-status-renderer' && $addedNode.attr('overlay-style') == "SHORTS") { // Travel up to video-renderer parent and hide it $addedNode.parents('ytd-grid-video-renderer').addClass('hiddenRenderer'); } }); } }); }); observer.observe(document.body, config); })();
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址