MangaPark Image Fix

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

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey, Greasemonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

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

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

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

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला 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 });
})();