Open Aired Entries

Opens all entries on your PTW that are currently airing or that have aired.

Устаревшая версия за 18.01.2018. Перейдите к последней версии.

// ==UserScript==
// @name         Open Aired Entries
// @namespace    https://greasyfork.org/en/users/96096-purple-pinapples
// @version      0.1
// @description  Opens all entries on your PTW that are currently airing or that have aired.
// @author       PurplePinapples
// @include      /^https?:\/\/(www\.)?myanimelist\.net\/profile\/[^\/]*\/?
// @exclude      /^https?:\/\/(www\.)?myanimelist\.net\/profile\/[^\/]*\/friends
// @exclude      /^https?:\/\/(www\.)?myanimelist\.net\/profile\/[^\/]*\/clubs
// @exclude      /^https?:\/\/(www\.)?myanimelist\.net\/profile\/[^\/]*\/recommendations
// @exclude      /^https?:\/\/(www\.)?myanimelist\.net\/profile\/[^\/]*\/reviews
// @include      /^https?:\/\/(www\.)?myanimelist\.net\/animelist\/[^\/]*?order=-14&status=6
// @license      MIT License
// ==/UserScript==

var OPEN_MAX_PAGES = 15;

(function () {
    "use strict";
    if (location.href.indexOf("/profile/") !== -1) { //if were on the profile page
        $("div.updates.anime").find("a:contains('Anime History')").after("<span class=\"floatRightHeader ff-Verdana\" style=\"padding-right: 10px;\"><a href=\"https://myanimelist.net/animelist/" + $("h1").first().find("span").text().trim().slice(0, -10) + "?order=-14&status=6\">Open Aired Entries</a></span>");
    } else { //else if were on the page which this opens pages from
        var openedPages = 0;
        $(".data.title.clearfix").each(function () {
            var contentStatus = $(this).find(".content-status").text().trim();
            if (contentStatus === "Airing" || contentStatus === "") {
                if (openedPages < OPEN_MAX_PAGES) {
                    window.open($(this).find(".link.sort").attr("href"));
                    openedPages = openedPages + 1;
                }
            }
        });
        //leave this page
        if ($(".username").text().trim() === "Your") {
            location.href = $("div.list-menu-float").find("a.profile").attr("href");
        } else if ($(".username").text().trim() !== "") {
            location.href = $(".username").attr("href");
        } else {
            location.href = "/";
        }
    }
})();