Remove Watched From Youtube Related Videos

Removes already watched videos from related videos.

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。

您需要先安装用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         Remove Watched From Youtube Related Videos
// @require      http://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  Removes already watched videos from related videos.
// @author       Mithaldu
// @match        https://www.youtube.com/*
// @grant        none
// ==/UserScript==

var run_count = 0;

function findwatched() {
    var progress_bar = $("ytd-thumbnail-overlay-resume-playback-renderer");
    if(!progress_bar.length) return;
    var step;
    for (step = 0; step < 5; step++) {
        var next = progress_bar.parent();
        if(!progress_bar.length) return progress_bar;
        progress_bar = next;
    }
    return progress_bar;
}

function remove_watched() {
    run_count++;
    var watched = findwatched();
    while (watched) {
        watched.remove();
        watched = findwatched();
    }
    if(run_count == 20) return;
    setTimeout(arguments.callee, 1000);
}

(function(){remove_watched()})(1000);