Remove Watched From Youtube Related Videos

Removes already watched videos from related videos.

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 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);