Force Load All Page

Forces the entire page to load immediately on ToonGod.

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

})();