MangaDexCentered

Centers images and hides scrollbar and right panel

K instalaci tototo skriptu si budete muset nainstalovat rozšíření jako Tampermonkey, Greasemonkey nebo Violentmonkey.

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

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          MangaDexCentered
// @namespace     MangaDexCentered
// @version       1.0
// @description   Centers images and hides scrollbar and right panel
// @author        Owyn
// @match         https://mangadex.com/chapter/*
// @match         https://mangadex.org/chapter/*
// @run-at        document-end
// @grant         none
// ==/UserScript==

let i = setInterval(dojob, 100);

function dojob()
{
	let img = document.querySelector("img.noselect");
	if(img && img.naturalWidth) // loaded
	{
		document.querySelector(".reader-controls-wrapper").remove();
		document.querySelector(".reader-main").classList.remove("reader-main");

		document.documentElement.style.overflow = "hidden"; // hide scrollbar
		document.body.style = "margin-right: -50px; padding-right: 50px; overflow-y: scroll; height: " +window.innerHeight+ "px;"; // wheel
		
		let sheet = document.createElement('style');
		sheet.innerHTML = ".reader.fit-horizontal .reader-images img { max-width: "+window.innerWidth+"px; }";
		document.body.appendChild(sheet);  // fix images not being 100% wide
		setInterval(function(){document.body.focus();}, 100); // fix arrows and space buttons not working
    
		clearInterval(i);
	}
}