Show favorited count - MAL (for mobile ver)

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

  1. // ==UserScript==
  2. // @name Show favorited count - MAL (for mobile ver)
  3. // @namespace https://myanimelist.net/profile/kyoyatempest
  4. // @version 1.2
  5. // @description Shows favorited anime,manga,characters,people,company count like "Favorite - Anime (10)" on mobile version
  6. // @author kyoyacchi
  7. // @match https://myanimelist.net/profile/*
  8. // @grant none
  9. // @icon https://t3.gstatic.com/faviconV2?client=SOCIAL&type=FAVICON&fallback_opts=TYPE,SIZE,URL&url=https://myanimelist.net&size=64
  10. // @run-at document-end
  11. // @license gpl-3.0
  12. // ==/UserScript==
  13.  
  14. (function() {
  15. 'use strict';
  16.  
  17.  
  18. const headerMappings = {
  19. "Favorites - Anime": "anime",
  20. "Favorites - Manga": "manga",
  21. "Favorites - Characters": "character",
  22. "Favorites - People": "person",
  23. "Favorites - Companies": "company"
  24. };
  25.  
  26. const headers = document.querySelectorAll(".header3");
  27. const sliders = document.querySelectorAll(".slider");
  28.  
  29. const counts = {
  30. anime: 0,
  31. manga: 0,
  32. character: 0,
  33. person: 0,
  34. company: 0
  35. };
  36.  
  37. sliders.forEach((slider) => {
  38. for (const key in headerMappings) {
  39. if (slider.classList.contains(`favorites-${headerMappings[key]}`)) {
  40. counts[headerMappings[key]]++;
  41. break;
  42. }
  43. }
  44. });
  45.  
  46. headers.forEach((header) => {
  47. const textContent = header.textContent.trim();
  48. if (headerMappings.hasOwnProperty(textContent)) {
  49. header.textContent += ` (${counts[headerMappings[textContent]]})`;
  50. }
  51. });
  52.  
  53. })();

QingJ © 2025

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