e(x)hentai image resizer

resizes images to fit the height of your current device

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

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

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

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         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()


})();