🎉 欢迎访问GreasyFork.Org 镜像站!本镜像站由公众号【爱吃馍】搭建,用于分享脚本。联系邮箱📮

Greasy fork 爱吃馍镜像

📂 缓存分发状态(共享加速已生效)
🕒 页面同步时间:2026/01/07 23:12:23
🔄 下次更新时间:2026/01/08 00:12:23
手动刷新缓存

MangaPark Broken Image Fix (s01 server)

Replace s02..s10.mp* par s01.mp* pour les images qui ne chargent pas sur MangaPark

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

🚀 安装遇到问题?关注公众号获取帮助

公众号二维码

扫码关注【爱吃馍】

回复【脚本】获取最新教程和防失联地址

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

🚀 安装遇到问题?关注公众号获取帮助

公众号二维码

扫码关注【爱吃馍】

回复【脚本】获取最新教程和防失联地址

// ==UserScript==
// @name         MangaPark Broken Image Fix (s01 server)
// @namespace    http://tampermonkey.net/
// @version      1.1
// @description  Replace s02..s10.mp* par s01.mp* pour les images qui ne chargent pas sur MangaPark
// @author       Toi + GPT
// @match        *://mangapark.net/*
// @match        *://mangapark.org/*
// @match        *://mangapark.io/*
// @run-at       document-end
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    const badServers = ['s02', 's03', 's04', 's05', 's06', 's07', 's08', 's09', 's10'];

    function replaceServersInString(str) {
        if (!str) return str;
        let newStr = str;
        badServers.forEach(s => {
            // remplace juste le début https://s0X.mp par https://s01.mp
            newStr = newStr.replace(`https://${s}.mp`, 'https://s01.mp');
        });
        return newStr;
    }

    function fixImg(img) {
        if (!img) return;

        // src direct
        if (img.src) {
            const fixed = replaceServersInString(img.src);
            if (fixed !== img.src) img.src = fixed;
        }

        // attributs de lazy-load fréquents
        const lazyAttrs = ['data-src', 'data-original', 'data-lazy'];
        lazyAttrs.forEach(attr => {
            const val = img.getAttribute(attr);
            if (!val) return;
            const fixed = replaceServersInString(val);
            if (fixed !== val) img.setAttribute(attr, fixed);
        });

        // srcset (plusieurs URLs)
        const srcsetAttrs = ['srcset', 'data-srcset'];
        srcsetAttrs.forEach(attr => {
            const val = img.getAttribute(attr);
            if (!val) return;

            const fixed = val
                .split(',')
                .map(part => {
                    const trimmed = part.trim();
                    if (!trimmed) return trimmed;
                    const bits = trimmed.split(/\s+/); // "url 1x"
                    bits[0] = replaceServersInString(bits[0]);
                    return bits.join(' ');
                })
                .join(', ');

            if (fixed !== val) img.setAttribute(attr, fixed);
        });
    }

    function fixAllImages(root = document) {
        const imgs = root.querySelectorAll('img');
        imgs.forEach(fixImg);
    }

    // 1) Au chargement de la page
    fixAllImages();

    // 2) Quand de nouveaux éléments apparaissent (scroll, changement de chapitre, etc.)
    const observer = new MutationObserver(mutations => {
        for (const mutation of mutations) {
            mutation.addedNodes.forEach(node => {
                if (!(node instanceof HTMLElement)) return;

                if (node.tagName === 'IMG') {
                    fixImg(node);
                } else {
                    fixAllImages(node);
                }
            });
        }
    });

    if (document.body) {
        observer.observe(document.body, { childList: true, subtree: true });
    }

    // Option debug : déscommente si tu veux vérifier que le script tourne
    // console.log('[MangaPark Fix] Script actif, images traitées:', document.images.length);
})();