MAL bigger images

bigger thumbnails on MAL

当前为 2022-01-03 提交的版本,查看 最新版本

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         MAL bigger images
// @namespace    https://greasyfork.org/en/users/12725-alistair1231
// @version      0.2
// @description  bigger thumbnails on MAL
// @author       Alistair1231
// @match        https://myanimelist.net/*
// @icon         https://icons.duckduckgo.com/ip2/myanimelist.net.ico
// @grant        none
// @require      https://code.jquery.com/jquery-3.6.0.min.js
// @license GPL-3.0
// ==/UserScript==

(function () {
    "use strict";
  
    setInterval(() => {
      jQuery(document).ready(
        jQuery("#content table .picSurround img").each(bigger)
      );
      jQuery(document).ready(
        jQuery("#content table .ranking-list img").each(bigger)
      );
  
      // make animelist/mangalist images bigger
      var checkExist = setInterval(function () {
        //first element in list
        if (location.href.split("/")[3] == "animelist") {
          if (
            $(
              "#list-container > div.list-block > div > table > tbody:nth-child(2) > tr.list-table-data > td.data.title.clearfix > a"
            ).length
          ) {
            jQuery(document).ready(
              jQuery(".list-table-data .data.image img").each(bigger)
            );
            clearInterval(checkExist);
          }
        }
        if (location.href.split("/")[3] == "mangalist") {
          if (
            $(
              "#list-container > div.list-block > div > table > tbody:nth-child(2) > tr.list-table-data > td.data.image > a"
            ).length
          ) {
            jQuery(document).ready(
              jQuery(".list-table-data .data.image img").each(bigger)
            );
            clearInterval(checkExist);
          }
        }
      }, 100); // check every 100ms
    }, 500);
  
    function bigger() {
      var el = $(this)[0];
      var imgTemp = el.src.match(/(\/images\/\w+\/\d+\/\d+)(?=t?\.\w{3,4})/)[0];
      var img = "https://cdn.myanimelist.net/" + imgTemp + ".jpg";
  
      // el.src = el.src.replace(/https:\/\/cdn\.myanimelist\.net\/r\/\d+x\d+(\/images\/anime\/\d+\/\d+).*$/g,"https://cdn.myanimelist.net/$1.jpg")
      el.height = 252;
      el.width = 180;
      jQuery(el).attr("srcset", img);
      jQuery(el).css("object-fit", "contain");
      // jQuery(el).attr('src',img)
      // jQuery(el).attr('data-srcset',img)
      // jQuery(el).attr('data-src',img)
      if (
        location.href.split("/")[3] == "animelist" ||
        location.href.split("/")[3] == "mangalist"
      )
        biggerList();
    }
  
    function biggerList() {
      jQuery(".list-table .list-table-data .data.image .image").css(
        "height",
        "252"
      );
      jQuery(".list-table .list-table-data .data.image .image").css(
        "width",
        "180"
      );
    }
  })();