Greasy Fork

Greasy Fork is available in English.

MP Image Fix 2026

Fix broken images on Mangapark, Comicpark, and Readpark

此脚本不应直接安装。它是供其他脚本使用的外部库,要使用该库请加入元指令 // @require https://update.greasyfork.icu/scripts/561126/1725892/MP%20Image%20Fix%202026.js

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         MP Image Fix 2026
// @namespace    http://greasyfork.icu/users/your-user-id
// @version      2026.3
// @description  Fix broken images on Mangapark, Comicpark, and Readpark
// @author       You
// @match        *://*.mangapark.*/*
// @match        *://*.comicpark.*/*
// @match        *://*.readpark.*/*
// @grant        none
// @run-at       document-end
// @license      MIT
// ==/UserScript==

(() => {
    const origin = location.origin;

    function getSource(img) {
        return (
            img.getAttribute("data-src") ||
            img.getAttribute("data-original") ||
            img.getAttribute("data-lazy-src") ||
            img.src
        );
    }

    function fix(img) {
        if (!(img instanceof HTMLImageElement)) return;
        if (img.dataset.mpFixed) return;

        const src = getSource(img);
        if (!src) return;

        // Match protocol-relative subdomain images like //s1.domain/path
        const match = src.match(/^\/\/s\d+\.[^/]+(\/.+)$/);
        if (!match) return;

        img.src = origin + match[1];
        img.dataset.mpFixed = "1";
    }

    function scan(root = document) {
        root.querySelectorAll("img").forEach(fix);
    }

    // Initial scan
    scan();

    // Observe dynamically added content
    new MutationObserver(mutations => {
        for (const m of mutations) {
            for (const n of m.addedNodes) {
                if (n.nodeType !== 1) continue;
                if (n.tagName === "IMG") fix(n);
                else scan(n);
            }
        }
    }).observe(document.body, {
        childList: true,
        subtree: true
    });
})();