Anime/Manga Favorited Status %

See the % of people that have watched and favorited an anime/manga in the entry status page.

当前为 2021-07-16 提交的版本,查看 最新版本

// ==UserScript==
// @name         Anime/Manga Favorited Status %
// @namespace    FavoriteStatus%
// @version      0.1
// @description  See the % of people that have watched and favorited an anime/manga in the entry status page.
// @author       hacker09
// @include      /^https:\/\/myanimelist\.net\/(anime|manga)\/[\d]+\/.*\/stats/
// @icon         https://www.google.com/s2/favicons?domain=myanimelist.net
// @run-at       document-end
// @grant        none
// ==/UserScript==

(function() {
  'use strict';
  var SummaryStats = [...[...document.querySelectorAll("h2")].find(h2 => h2.textContent === "Summary Stats").parentNode.querySelectorAll("span")]; //Save the summary stats to variable
  var SavedTotal = SummaryStats.find(info => info.innerText.includes("Total:")).innerText; //Save the total users stats to variable
  var Information = [...[...document.querySelectorAll("h2")].find(h2 => h2.textContent === "Information").parentNode.querySelectorAll("div")]; //Save the Information stats to variable
  var Favorites = parseFloat(Information.find(info => info.innerText.includes('Favorites: ')).innerText.match(/\d+,?\d+,?\d+/)[0].replaceAll(',', '')); //Save the Favs to variable
  var TotalUsers = parseFloat(SummaryStats.find(info => info.innerText.includes("Total:")).parentNode.innerText.match(/\d+,?\d+,?\d+/)[0].replaceAll(',', '')); //Save the TotalUsers to variable
  var PTWR = parseFloat(SummaryStats.find(info => info.innerText.includes('Plan to ')).parentNode.innerText.match(/\d+,?\d+,?\d+/)[0].replaceAll(',', '')); //Save the PTWR to variable

  SummaryStats.find(info => info.innerText.includes("Total:")).innerText = 'Favorited: ' + ((Favorites) / ((TotalUsers) - (PTWR))).toLocaleString("en", { //Do the math and show the result
    style: 'percent', //Show the result as %
    minimumFractionDigits: 2 //Show the % with 2 decimals
  }) + '\n' + SavedTotal; //Add a break line and show the total number below the Favorites: % number
  SummaryStats.find(info => info.innerText.includes("Total:")).title = `( ${Favorites} )/(( ${TotalUsers} ) - ( ${PTWR} ))`; //Show the math on mouse hover
})();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址