Greasy Fork

Greasy Fork is available in English.

Mangadex - Colorize Follow Status

Highlight the titles on the home and updates pages with different colors to show which ones you're following, dropped, etc.

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name        Mangadex - Colorize Follow Status
// @namespace   Violentmonkey Scripts
// @match       https://mangadex.org/
// @match       https://mangadex.org/updates
// @grant       none
// @version     1.1
// @author      2TspSalt
// @description Highlight the titles on the home and updates pages with different colors to show which ones you're following, dropped, etc.
// @noframes
// ==/UserScript==

(function () {
  // CHANGE THESE COLORS TO CUSTOMIZE!
  var colorStatus = [
    undefined,
    "LawnGreen",        // 1. Reading
    "MediumBlue",       // 2. Completed
    "Gold",             // 3. On Hold
    "MediumTurquoise",  // 4. Plan to Read
    "FireBrick",        // 5. Dropped
    "DarkMagenta",      // 6. Re-Reading
  ];

  function applyFollowStyle(data) {
    return function (a) {
      var idStr = a.href.match(/\/title\/([\d]+)\//)[1];
      if (!idStr) return;

      var idVal = parseInt(idStr, 10);
      var followType = (
        data.find(function (m) {
          return m.mangaId === idVal;
        }) || {}
      ).followType;
      if (!followType) return;

      var c = colorStatus[followType];
      a.style.color = c;
      a.parentElement.style.color = c;
    };
  }

  fetch("https://api.mangadex.org/v2/user/me/followed-manga", {
    credentials: "include",
  })
    .then(function (r) {
      return r.json();
    })
    .then(function (body) {
      if (Array.isArray(body.data)) {
        Array.from(document.querySelectorAll(".manga_title"))
          .filter(function (a) {
            return a.href;
          })
          .forEach(applyFollowStyle(body.data));
      }
    });
})();