LtGrimdark / Marvel Unlimited Free Zoom

// ==UserScript==
// @name         Marvel Unlimited Free Zoom
// @namespace    http://tampermonkey.net/
// @version      0.1
// @author       Lt. Grimdark
// @match        https://read.marvel.com/
// @grant        none
// @license      MIT
// @require http://code.jquery.com/jquery-1.12.4.min.js
// ==/UserScript==

(function() {
    'use strict';
    jQuery(document).ready(function($) {
        // Create styled input element & enable scrolling
        $('body').append('<div style="position: absolute; width: 80px; height: 30px;left: 0; top: 50vh; z-index: 10000; background-color: #9f9f9f;"><input class="zoom-input" style="width: 50px; height: 30px;" id="customZoom" type="text" value="100"/><button id="custom-zoom-reset" style="width: 30px; height: 30px; color: #000;">x</button></div>');

        // Update height of image containers on keyup in previously inserted input element
        $('#customZoom').keyup(function() {
            if(!$.isNumeric($(this).val()) || $(this).val() < 1) {
                $(this).val(100);
            }
            $('svg:not(:root)').attr('style', 'height: ' + $(this).val() + '% !important;');
            $('#page').css('overflow', 'scroll');
        });

        // Scroll page to top if the content of the outer container changes (eg. when jumping to the next or previous page)
        $('#page').on("DOMSubtreeModified",function(){
            $('#page').scrollTop(0);
        });

        // Undo changes to height on button click
        $('#custom-zoom-reset').click(function(){
            $('#customZoom').val(100);
            $('svg:not(:root)').removeAttr('style');
            $('#page').css('overflow', 'hidden');
        })
    });
})();