e(x)hentai image resizer

resizes images to fit the height of your current device

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         e(x)hentai image resizer
// @namespace    https://greasyfork.org/users/780477
// @version      0.3
// @description  resizes images to fit the height of your current device
// @match        *://e-hentai.org/s/*
// @match        *://exhentai.org/s/*
// @grant        none
// ==/UserScript==

function change_css(){
    const img = document.getElementById('img')
    img.style.width = ''
    img.style.height = '90vh'
}

(function() {
    'use strict';

    // credits https://stackoverflow.com/a/46428962
    var oldHref = document.location.href

    var
    bodyList = document.querySelector("body")

    ,observer = new MutationObserver(function(mutations) {

        mutations.forEach(function(mutation) {

            if (oldHref != document.location.href) {

                oldHref = document.location.href;

                change_css()

            }

        });

    });

    var config = {
        childList: true,
        subtree: true
    };

    observer.observe(bodyList, config);


    change_css()


})();