Annict Hide Future Programs

Hide programs for the next day or later in Annict track page. In addition, it hides works that have no unwatched episodes.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Greasemonkey lub Violentmonkey.

You will need to install an extension such as Tampermonkey to install this script.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana będzie instalacja rozszerzenia Tampermonkey lub Userscripts.

You will need to install an extension such as Tampermonkey to install this script.

Aby zainstalować ten skrypt, musisz zainstalować rozszerzenie menedżera skryptów użytkownika.

(Mam już menedżera skryptów użytkownika, pozwól mi to zainstalować!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Musisz zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

(Mam już menedżera stylów użytkownika, pozwól mi to zainstalować!)

// ==UserScript==
// @name            Annict Hide Future Programs
// @namespace       https://github.com/SlashNephy
// @version         0.1.7
// @author          SlashNephy
// @description     Hide programs for the next day or later in Annict track page. In addition, it hides works that have no unwatched episodes.
// @description:ja  Annict の「記録するページ」で翌日以降の番組を非表示にします。さらに未視聴エピソードがない作品を非表示にします。
// @homepage        https://scrapbox.io/slashnephy/Annict_%E3%81%AE%E8%A8%98%E9%8C%B2%E3%83%9A%E3%83%BC%E3%82%B8%E3%81%A7%E6%9C%AA%E6%9D%A5%E3%81%AE%E6%94%BE%E9%80%81%E4%BA%88%E5%AE%9A%E3%82%92%E9%9D%9E%E8%A1%A8%E7%A4%BA%E3%81%AB%E3%81%99%E3%82%8B_UserScript
// @homepageURL     https://scrapbox.io/slashnephy/Annict_%E3%81%AE%E8%A8%98%E9%8C%B2%E3%83%9A%E3%83%BC%E3%82%B8%E3%81%A7%E6%9C%AA%E6%9D%A5%E3%81%AE%E6%94%BE%E9%80%81%E4%BA%88%E5%AE%9A%E3%82%92%E9%9D%9E%E8%A1%A8%E7%A4%BA%E3%81%AB%E3%81%99%E3%82%8B_UserScript
// @icon            https://www.google.com/s2/favicons?sz=64&domain=annict.com
// @supportURL      https://github.com/SlashNephy/userscripts/issues
// @match           https://annict.com/*
// @grant           none
// @license         MIT license
// ==/UserScript==

(function () {
    'use strict';

    const main = () => {
        if (!window.location.href.startsWith('https://annict.com/track')) {
            return;
        }
        for (const card of document.querySelectorAll('div.card.u-card-flat')) {
            const iconElement = card.querySelector('.fa-check-circle');
            if (iconElement) {
                card.style.display = 'none';
                continue;
            }
            const content = card.querySelector('div.col div[class="small"] span.text-muted')?.textContent;
            if (!content) {
                continue;
            }
            const datetime = Date.parse(content);
            const today = Date.now();
            if (datetime > today + 24 * 60 * 60 * 1000) {
                card.style.display = 'none';
            }
        }
    };
    document.addEventListener('turbo:load', () => {
        main();
    });

})();