Greasy Fork

Greasy Fork is available in English.

MangaNato (Formerly Manganelo) Scripts (Next/Prev Chapter & Image Resize)

Allows L/R arrow key navigation between chapters & reize chapter images using / key.

当前为 2021-05-30 提交的版本,查看 最新版本

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name        MangaNato (Formerly Manganelo) Scripts (Next/Prev Chapter & Image Resize)
// @namespace   ew0345
// @match       *://readmanganato.com/*/*
// @grant       none
// @version     1.4
// @author      ew0345, Qther
// @description Allows L/R arrow key navigation between chapters & reize chapter images using / key.
// @icon        https://manganato.com/favicon-96x96.png
// ==/UserScript==

var chapterImages = ['.container-chapter-reader img'];
var chapterButtons = ['.navi-change-chapter-btn-prev', '.navi-change-chapter-btn-next'];
var widthPercent = 100;

function resize() {
    var inp = prompt('Image Width / %\n\'autoh\' to fit images to page height,\n\'autow\' to fit images to page width.');
	widthPercent = inp.valueOf().toLowerCase();

    if (widthPercent === "autow" || widthPercent === "w" || widthPercent === "fitw") {
        var pageWidth = document.body.clientWidth;

        for (var i = 0; i < document.querySelectorAll(chapterImages).length; i++) {
            document.querySelectorAll(chapterImages)[i].style.width = pageWidth / document.querySelectorAll(chapterImages)[i].width * 100 + '%';
        }
    } else if (widthPercent === "autoh" || widthPercent === "h" || widthPercent === "fith" || widthPercent === "4koma") {
        var pageWidth = document.body.clientWidth;
        var pageHeight = window.height;

        for (var i = 0; i < document.querySelectorAll(chapterImages).length; i++) {
            document.querySelectorAll(chapterImages)[i].style.width = pageWidth / document.querySelectorAll(chapterImages)[i].width * 100 + '%';
            document.querySelectorAll(chapterImages)[i].style.width = pageHeight / document.querySelectorAll(chapterImages)[i].height * 100 + '%';
        }
    } else if (widthPercent === 0) {
    	return;
    } else {
        for (var i = 0; i < document.querySelectorAll(chapterImages).length; i++) {
            document.querySelectorAll(chapterImages)[i].style.width = widthPercent + '%';
        }
    }
}

window.onkeydown = function(e) {
    switch (e.key) {
        case "ArrowLeft":
          document.querySelectorAll(chapterButtons[0]).length > 0 ? document.location = document.querySelectorAll(chapterButtons[0])[0].href : console.error('Already on first chapter.');
           break;
        case "ArrowRight":
           document.querySelectorAll(chapterButtons[1]).length > 0 ? document.location = document.querySelectorAll(chapterButtons[1])[0].href : console.error('Already on last chapter');
           break;
        case "/":
        	resize();
            break;
        default:
            break;
    }
}