Temp fix mangapark

Fix the current broken page on mangapark

K instalaci tototo skriptu si budete muset nainstalovat rozšíření jako Tampermonkey, Greasemonkey nebo Violentmonkey.

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

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Userscripts.

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

K instalaci tohoto skriptu si budete muset nainstalovat manažer uživatelských skriptů.

(Už mám manažer uživatelských skriptů, nechte mě ho nainstalovat!)

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.

(Už mám manažer uživatelských stylů, nechte mě ho nainstalovat!)

// ==UserScript==
// @name         Temp fix mangapark
// @namespace    http://tampermonkey.net/
// @version      1.05
// @description  Fix the current broken page on mangapark
// @author       James
// @license      MIT
// @match        https://mangapark.net/title/*
// @match        https://mangapark.org/title/*
// @match        https://mangapark.io/title/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=mangapark.net
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    var images = document.getElementsByTagName('img');

    let retries = 11;

    let integer = 0;

    const regex = new RegExp("^https:\/\/s\\d\\d");

    var timeoutId = setTimeout(_ => {

        const intervalID = setInterval(_ => {
            for(var i = 0; i < images.length; i++) {
                if (images[i].naturalWidth === 0) {
                    if(images[i].src.match(regex)){
                        images[i].src = images[i].src.replace(regex, images[i].src.match(regex)[0].substring(0, images[i].src.match(regex)[0].length - 2) + String(integer).padStart(2, '0'));//We try all combination from 00 to 10
                    }
                }
            }
            integer++;
            retries--;
            if(retries == 0){
                images = null;
                clearInterval(intervalID);
            }
        }, 1500);//Attempt evey 1.5 seconds

    }, 1000);//1 second dealy


})();