Greasy Fork

Greasy Fork is available in English.

MangaDexCentered

Centers images and hides scrollbar and right panel

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==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);
	}
}