meogao222's EH Thumbnail show

my EH script, display thumbnails on the list

K instalaci tototo skriptu si budete muset nainstalovat rozšíření jako Tampermonkey, Greasemonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Userscripts.

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

K instalaci tohoto skriptu si budete muset nainstalovat manažer uživatelských skriptů.

(Už mám manažer uživatelských skriptů, nechte mě ho nainstalovat!)

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.

(Už mám manažer uživatelských stylů, nechte mě ho nainstalovat!)

// ==UserScript==
// @name         meogao222's EH Thumbnail show
// @namespace    http://tampermonkey.net/
// @version      1.0
// @description  my EH script, display thumbnails on the list
// @author       You
// @match        https://e-hentai.org/?f_search=*
// @match        https://e-hentai.org/
// @match        https://e-hentai.org/uploader/*
// @icon         data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
// @grant        none
// @license      MIT
// ==/UserScript==

(function() {
    'use strict';
    // Your code here...

//    setTimeout(start, 200);
    start();

    function start(){
        var allTrEles = document.getElementsByClassName('itg gltc')[0].childNodes[0].childNodes;

        allTrEles.forEach((ele)=>{
            var gl1c = ele.getElementsByClassName('gl1c glcat')[0];
            var gl2cDiv = ele.getElementsByClassName('gl2c')[0];
            if (gl2cDiv){
                var glThumbEle = gl2cDiv.getElementsByClassName('glthumb')[0];
                var imgEleLink = glThumbEle.childNodes[0].childNodes[0].getAttribute('data-src');
                if (!imgEleLink){
                    imgEleLink = glThumbEle.childNodes[0].childNodes[0].getAttribute('src');
                }
                var thumbEle = document.createElement('img');
                thumbEle.setAttribute('src', imgEleLink);
                gl1c.replaceWith(thumbEle);
                glThumbEle.remove();
            }

        });
    }
})();