您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Remove Shorts from subscription page
// ==UserScript== // @name ShortRemover // @namespace http://tampermonkey.net/ // @version 0.03 // @description Remove Shorts from subscription page // @author JP // @match https://www.youtube.com/* // @grant none // @license MIT // ==/UserScript== (function() { 'use strict'; function observeDOM(callback){ var mutationObserver = new MutationObserver(function(mutations) { //https://davidwalsh.name/mutationobserver-api mutations.forEach(function(mutation) { callback(mutation) }); }); // Keep an eye on the DOM for changes mutationObserver.observe(document.body, { //https://blog.sessionstack.com/how-javascript-works-tracking-changes-in-the-dom-using-mutationobserver-86adc7446401 attributes: true, childList: true, subtree: true, attributeFilter: ["class"] }); } function run(){ var allVideoDivs = document.querySelectorAll('ytd-grid-video-renderer') for( const video of allVideoDivs){ var theLink = video.querySelector('a').href if(theLink.includes('shorts')){ video.remove() } } } observeDOM(doDomStuff); function doDomStuff(mutation){ if(mutation.target.id === "items"){ run(); } } })();