Kemono Auto Full-Res Images

Automatically load full-res images on Kemono without a button, optimized for dynamic navigation (SPA-friendly). 🔥

Bu betiği kurabilmeniz için Tampermonkey, Greasemonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Userscripts gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

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

Bu komut dosyasını yüklemek için bir kullanıcı komut dosyası yöneticisi uzantısı yüklemeniz gerekecek.

(Zaten bir kullanıcı komut dosyası yöneticim var, kurmama izin verin!)

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.

(Zateb bir user-style yöneticim var, yükleyeyim!)

// ==UserScript==
// @name         Kemono Auto Full-Res Images
// @namespace    http://tampermonkey.net/
// @version      1.1
// @description  Automatically load full-res images on Kemono without a button, optimized for dynamic navigation (SPA-friendly). 🔥
// @author       rockyjoe554
// @license MI
// @match        https://kemono.su/*
// @grant        none
// ==/UserScript==

(function () {
    'use strict';

    let lastUrl = location.href;

    function upgradeImages() {
        const thumbs = document.querySelectorAll('.post__thumbnail a.fileThumb img');

        thumbs.forEach(img => {
            const link = img.closest('a.fileThumb');
            if (!link) return;

            const fullUrl = link.href;
            if (img.src !== fullUrl) {
                img.src = fullUrl;
                img.setAttribute('data-src', fullUrl);
                img.loading = 'eager';
            }
        });
    }

    function waitForImagesAndUpgrade() {
        const maxAttempts = 20;
        let attempt = 0;

        const interval = setInterval(() => {
            attempt++;
            const thumbs = document.querySelectorAll('.post__thumbnail a.fileThumb img');
            if (thumbs.length > 0) {
                upgradeImages();
                clearInterval(interval);
            } else if (attempt >= maxAttempts) {
                clearInterval(interval);
            }
        }, 250);
    }

    const observer = new MutationObserver(() => {
        const currentUrl = location.href;
        if (currentUrl !== lastUrl) {
            lastUrl = currentUrl;
            waitForImagesAndUpgrade();
        }
    });

    observer.observe(document.body, { childList: true, subtree: true });

    window.addEventListener('load', waitForImagesAndUpgrade);
})();