您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Calculate the expected finished airing date for anime entries.
当前为
// ==UserScript== // @name Finish Airing Date - MAL // @namespace https://greasyfork.org/en/users/670188-hacker09?sort=daily_installs // @version 2 // @description Calculate the expected finished airing date for anime entries. // @author hacker09 // @match https://myanimelist.net/anime/* // @icon https://t3.gstatic.com/faviconV2?client=SOCIAL&type=FAVICON&fallback_opts=TYPE,SIZE,URL&url=http://myanimelist.net&size=64 // @run-at document-end // @grant none // ==/UserScript== (function() { 'use strict'; const startDateElement = [...[...document.querySelectorAll("h2")].find(h2 => h2.textContent === "Information").parentNode.querySelectorAll("div")].find(info => info.innerText.includes("Aired")).querySelector("span"); //Get the start date from the page if (startDateElement.parentNode.textContent.match(/\?/) !== null && document.querySelector("#curEps").innerText !== '?') { //If the finished date is unknown and the total entry eps are known var startDateMatch = startDateElement.parentNode.textContent.match(/(\w{3})\s((\d{1,2}),\s)?(\d{4})/); //Save the start date var month = {'Jan': 1, 'Feb': 2, 'Mar': 3, 'Apr': 4, 'May': 5, 'Jun': 6, 'Jul': 7, 'Aug': 8, 'Sep': 9, 'Oct': 10, 'Nov': 11, 'Dec': 12}[startDateMatch[1]]; //Convert start month to number var startDate = new Date(parseInt(startDateMatch[4]), month - 1, startDateMatch[2] === undefined ? 0 : parseInt(startDateMatch[2])); //Save start date Year, month, day var expectedFinishedAiringDate = new Date(startDate.getTime() + parseInt(document.querySelector("#curEps").innerText) * 7 * 24 * 60 * 60 * 1000); //Calculate the expected finished date startDateElement.parentNode.className += ' dark_text'; //Make the text bold startDateElement.nextSibling.textContent = startDateElement.nextSibling.textContent.replace(/\?/g, ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"][expectedFinishedAiringDate.getMonth()] + ' ' + (startDateMatch[2] === undefined ? '' : expectedFinishedAiringDate.getDate() + ', ') + expectedFinishedAiringDate.getFullYear()); //Replace ? with the finished and formatted date } //Finishes the if condition })();