vip.leg.xyz 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        vip.leg.xyz Full Image Limiter + scroll into view
// @namespace https://greasyfork.org/users/720957
// @match       https://vip.leg.xyz/*/content/*
// @grant       none
// @version     1.2
// @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.
// ==/UserScript==
(() => {
    "use strict";

    var styles = `
  .ncimage 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(".ncimage img").scrollIntoView(true);
    }, false);


})();