Force Load All Page

Forces the entire page to load immediately on ToonGod.

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         Force Load All Page
// @namespace    http://tampermonkey.net/
// @version      1.0
// @description  Forces the entire page to load immediately on ToonGod.
// @author       Idhtft
// @match        https://www.toongod.org/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=toongod.org
// @grant        none
// @run-at       document-end
// @license MIT
// ==/UserScript==

(function() {
    'use strict';

    const TARGET_SELECTOR = '.reading-content img';

    function forceLoadImages() {
        const images = document.querySelectorAll(TARGET_SELECTOR);

        images.forEach(img => {
            const dataSrc = img.getAttribute('data-src') ||
                            img.getAttribute('data-lazy-src') ||
                            img.getAttribute('data-original');

            if (dataSrc && img.src !== dataSrc) {
                img.src = dataSrc;
                img.style.opacity = '1';
                img.style.display = 'block';

                img.classList.add('loaded');
                img.classList.remove('lazy', 'lazyload');

                img.removeAttribute('data-src');
                img.removeAttribute('data-lazy-src');
            }
        });
    }

    window.addEventListener('load', forceLoadImages);
    forceLoadImages();

    const observer = new MutationObserver((mutations) => {
        let shouldRun = false;
        mutations.forEach((mutation) => {
            if (mutation.addedNodes.length) {
                shouldRun = true;
            }
        });
        if (shouldRun) {
            forceLoadImages();
        }
    });

    const container = document.querySelector('body');
    if (container) {
        observer.observe(container, { childList: true, subtree: true });
    }

    let count = 0;
    const interval = setInterval(() => {
        forceLoadImages();
        count++;
        if(count > 5) clearInterval(interval);
    }, 2000);

})();