MangaPark Image Fix

Forces MangaPark images to use priority hosts (s01 > s03 > s05 > s06 > s00 > s04)

이 스크립트를 설치하려면 Tampermonkey, Greasemonkey 또는 Violentmonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey와 같은 확장 프로그램을 설치해야 합니다.

이 스크립트를 설치하려면 Tampermonkey 또는 Violentmonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey 또는 Userscripts와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 유저 스크립트 관리자 확장 프로그램이 필요합니다.

(이미 유저 스크립트 관리자가 설치되어 있습니다. 설치를 진행합니다!)

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

(이미 유저 스타일 관리자가 설치되어 있습니다. 설치를 진행합니다!)

// ==UserScript==
// @name         MangaPark Image Fix
// @namespace    https://mangapark.net/
// @version      1.0
// @description  Forces MangaPark images to use priority hosts (s01 > s03 > s05 > s06 > s00 > s04)
// @match        *://*.mangapark.org/*
// @match        *://*.mangapark.net/*
// @match        *://*.mangapark.to/*
// @match        *://*.mangapark.io/*
// @match        *://*.comicpark.org/*
// @match        *://*.comicpark.to/*
// @match        *://*.readpark.org/*
// @match        *://*.readpark.net/*
// @match        *://*.mpark.to/*
// @match        *://*.fto.to/*
// @match        *://*.jto.to/*
// @run-at       document-end
// @grant        none
// @license      MIT
// ==/UserScript==
(function () {
    const hosts = ['01', '03', '05', '06', '00', '04'];
    let index = 0;

    const fix = () =>
        document.querySelectorAll('img[src*=".mp"]').forEach(img => {
            const orig = img.src;
            const next = orig.replace(/s0\d\.mp|s10\.mp/g, `s${hosts[index]}.mp`);
            if (orig !== next) {
                img.src = next;
                img.onerror = () => {
                    index = (index + 1) % hosts.length;
                    if (index !== 0) {
                        img.src = orig.replace(/s0\d\.mp|s10\.mp/g, `s${hosts[index]}.mp`);
                    }
                };
            }
        });
    fix();
    new MutationObserver(fix).observe(document.body, { childList: true, subtree: true });
})();