您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
on each and every page except the Shorts page.
当前为
// ==UserScript== // @name Remove YouTube Shorts // @description on each and every page except the Shorts page. // @version 1.2 // @grant none // @match https://www.youtube.com/* // @exclude https://www.youtube.com/shorts/* // @license MIT // @namespace Remove YouTube Shorts automatically // ==/UserScript== if (!localStorage.getItem("dSButtonSettings")) { localStorage.setItem("dSButtonSettings", "red"); } var timeStatusOverlay = document.getElementsByTagName('ytd-thumbnail-overlay-time-status-renderer'); var i = 0; function delShorts() { if (i != timeStatusOverlay.length) { i = 0; while (i < timeStatusOverlay.length) { if (timeStatusOverlay[i].getAttribute("overlay-style") == 'SHORTS') { timeStatusOverlay[i].parentElement.parentElement.parentElement.parentElement.parentElement.remove(); continue; } else { i++; } } } } var delShortsInterval; if (localStorage.getItem("dSButtonSettings") == 'green') { delShortsInterval = setInterval(delShorts, 1000); } const div = document.createElement('DIV'); div.id = 'dSDiv'; div.style.position = 'absolute'; div.style.zIndex = '99999'; const button = document.createElement('BUTTON'); button.id = 'dSButton'; button.innerHTML = 'DEL Shorts'; button.style.border = 'none'; button.style.color = 'white'; button.style.fontSize = '1rem'; button.style.background = localStorage.getItem("dSButtonSettings"); button.addEventListener('click', function () { if (button.style.background == 'red' || button.style.background == 'red none repeat scroll 0% 0%') { button.style.background = 'green'; localStorage.setItem("dSButtonSettings", "green"); delShortsInterval = setInterval(delShorts, 1000); } else if (button.style.background == 'green' || button.style.background == 'green none repeat scroll 0% 0%') { button.style.background = 'red'; localStorage.setItem("dSButtonSettings", "red"); clearInterval(delShortsInterval); } }); div.appendChild(button); document.getElementById('center').appendChild(div);