您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
YouTube - Hide Watched.
// ==UserScript== // @name YouTube - Hide Watched // @description YouTube - Hide Watched. // @version 0.7 // @author to // @namespace https://github.com/to // @license MIT // // @match https://www.youtube.com/* // @exclude https://www.youtube.com/feed/history // @icon https://www.google.com/s2/favicons?sz=64&domain=youtube.com // // @run-at document-idle // ==/UserScript== const THRESHOLD = 90; new MutationObserver(throttleAndDebounce(() => { for (let progress of document.querySelectorAll('#progress')) { if (parseInt(progress.style.width) > THRESHOLD) { let video = progress.closest('ytd-rich-item-renderer') || progress.closest('ytd-video-renderer') || progress.closest('ytd-grid-video-renderer') || progress.closest('ytd-compact-video-renderer') if (video) { video.style.display = 'none'; video.classList.add('tm-watched') } } } }, 500)).observe(document, { childList: true, subtree: true, }); function throttleAndDebounce(fn, interval) { let timer; let lastTime = Date.now() - interval; return function () { if ((Date.now() - lastTime) > interval) { lastTime = Date.now(); fn(); } else { clearTimeout(timer); timer = setTimeout(() => { fn(); }, interval); } } }