Temp fix mangapark

Fix the current broken page on mangapark

Dovrai installare un'estensione come Tampermonkey, Greasemonkey o Violentmonkey per installare questo script.

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

Dovrai installare un'estensione come Tampermonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Userscripts per installare questo script.

Dovrai installare un'estensione come ad esempio Tampermonkey per installare questo script.

Dovrai installare un gestore di script utente per installare questo script.

(Ho già un gestore di script utente, lasciamelo installare!)

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

(Ho già un gestore di stile utente, lasciamelo installare!)

// ==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


})();