Simkl TV Next Episode Date

Replaces "Airing" column with "Next Episode Date" column

目前為 2019-12-20 提交的版本,檢視 最新版本

// ==UserScript==
// @name         Simkl TV Next Episode Date
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  Replaces "Airing" column with "Next Episode Date" column
// @author       jessequentin
// @match        https://simkl.com/*/tv/watching/
// @grant        none
// @require      https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js
// ==/UserScript==

(function() {
    'use strict';
    $("img[alt='Airing']").closest("a").text("Next Episode Date");

    $(".SimklTVMyTableTRTitle").each(function() {
        var showlink = $(this).find("a").attr('href');
        $(this).siblings(".SimklTVMyTableTRAiring").load( showlink + " .SimklTVAboutBlockBottomEpisodes > table ", function () {
            $(this).find('.SimklTVAboutBlockEpisodeWhich:contains("Previous")').closest("table").replaceWith("<div class=TBD>TBD</div>");
            var smtab=$(this).find('.SimklTVAboutBlockEpisodeWhich').closest("table");
            $(smtab).closest("td").each(function() { $(this).siblings().remove(); });
            var infotab=$(smtab).find("a[rel='nofollow']").first().closest("td");
            $(smtab).find("a[rel='nofollow']").replaceWith(function() { return this.innerHTML; });
            $(this).find('.SimklTVAboutBlockEpisodeWhich').closest("tr").remove();
            $(this).find('.TBD').closest("td").each(function() { $(this).siblings().remove(); });
            $(this).find('span').replaceWith(function() { return this.innerHTML; });
            var eplink=$(infotab).siblings().first().find("a").attr("href");
            var infostring=$(infotab).text();
            var infodate=infostring.match(/[0-9]+\-[0-9]+\-[0-9]+/g);
            infodate=infodate?String(infodate).replace(/\-/g,"/"):"TBD";
            var airdate = (infodate&&infodate!="TBD")?Date.parse(infodate):14399999996400;
            if(!eplink) eplink=showlink;
            $(this).replaceWith('<td class="SimklTVMyTableTRAiring SimklTVMyTableTRTitle" width="155"><a href="'+eplink+'"><span>'+airdate+"</span>"+infodate+"</a></td>");
        })
    });
})();