Show favorited anime, manga etc.. count like in PC ver.

Shows favorited anime,manga,characters,people,company count like "Favorite - Anime (10)" on mobile version

目前为 2023-06-15 提交的版本。查看 最新版本

// ==UserScript==
// @name         Show favorited anime, manga etc.. count like in PC ver.
// @namespace    https://myanimelist.net/profile/kyoyatempest
// @version      1.1
// @description  Shows favorited anime,manga,characters,people,company count like "Favorite - Anime (10)" on mobile version
// @author       kyoyacchi
// @match        https://myanimelist.net/profile/*
// @grant        none
// @icon         https://t3.gstatic.com/faviconV2?client=SOCIAL&type=FAVICON&fallback_opts=TYPE,SIZE,URL&url=https://myanimelist.net&size=64
// @run-at       document-end
// @license      gpl-3.0
// ==/UserScript==

(function() {
    'use strict';

    let anime,
        manga,
        characters,
        people,
        company;


  anime = document.querySelectorAll(".slider.favorites-anime").length
  manga= document.querySelectorAll(".slider.favorites-manga").length;
  characters = document.querySelectorAll(".slider.favorites-character").length;
  people = document.querySelectorAll(".slider.favorites-person").length;
  company = document.querySelectorAll(".slider.favorites-company").length;


  let aniheader,
      mangaheader,
      charactersheader,
      peopleheader,
      companyheader;


  const headers = document.querySelectorAll(".header3");


headers.forEach((el) => {
  if (el.textContent === "Favorites - Anime") {
    aniheader = el;
  }

  if (el.textContent === "Favorites - Manga"){
    mangaheader = el;
  }
  if (el.textContent === "Favorites - Characters"){
    charactersheader = el;
  }
  if (el.textContent === "Favorites - People"){
    peopleheader = el;
  }
  if (el.textContent === "Favorites - Companies"){
    companyheader = el;
  }
});

 if (aniheader){ aniheader.textContent += ` (${anime})`; }

if (mangaheader){mangaheader.textContent += ` (${manga})` }

  if (charactersheader){charactersheader.textContent += ` (${characters})` }

 if (peopleheader){ peopleheader.textContent += ` (${people})` }

 if (companyheader){companyheader.textContent += ` (${company})` }



})();