Greasy Fork

Greasy Fork is available in English.

Twitch Rerun Hider

Hide Reruns from the following page

目前为 2018-06-01 提交的版本。查看 最新版本

// ==UserScript==
// @name         Twitch Rerun Hider
// @namespace    http://grh.se
// @version      1.1.1
// @description  Hide Reruns from the following page
// @author       Markus Persson
// @include      *://www.twitch.tv/*
// @grant        none
// @require      https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js
// @comment      Based upon the work of Max Brown, "Twitch VODCAST remover".
// ==/UserScript==

(function() {
    'use strict';

    $(document).ready(function() {
       var maxTry = 200; // 20 secounds
       var i = 0;
       var inVal = setInterval(function() {
           hideReruns();
           if (i == maxTry) {
               clearInterval(inVal);
           }
           i++;
       }, 100);
    });
})();

function hideReruns() {
    // Good streams, they tag it as a rerun
    $(".stream-type-indicator--rerun").each(function(i, e) {
        $(e).parents(".tw-mg-b-2").hide();
    });

    // Mediocre streams, they don't tag it right but at least type it in the title...
    $(".stream-type-indicator--live").each(function(i, e) {
        if ($(e).parents(".tw-mg-b-2").find("h3").text().toLowerCase().includes("rerun")) {
            $(e).parents(".tw-mg-b-2").hide();
        }
    });
}