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.

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

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

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.

(I already have a user style manager, let me install it!)

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

})();