zzup.com Full Image Limiter + scroll into view

Limit the size of images in "Full Gallery" mode to the dimensions of the window. Images will use as much space as possible without overflow.

// ==UserScript==
// @name        zzup.com Full Image Limiter + scroll into view
// @namespace https://greasyfork.org/users/720957
// @match       https://zzup.com/viewimage/*
// @match       https://archive.zzup.com/viewimage/*
// @grant       none
// @version     1.0
// @author      pleazy
// @description Limit the size of images in "Full Gallery" mode to the dimensions of the window. Images will use as much space as possible without overflow.
// @license MIT
// ==/UserScript==
(() => {
    "use strict";

    var styles = `
  center > a > img {
    width: initial !important;
    height: initial !important;
    max-width: 100%;
    max-height: 100vh;
  }
`;

    var styleSheet = document.createElement("style");
    styleSheet.type = "text/css";
    styleSheet.innerText = styles;
    document.head.appendChild(styleSheet);

    window.addEventListener('load', function() {
        document.querySelector("center > a > img").scrollIntoView(true);
    }, false);

})();