Nhentai scroll

scroll to read picture in nhentai

Od 09.02.2021.. Pogledajte najnovija verzija.

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

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

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

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

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

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

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.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name         Nhentai scroll
// @namespace    https://github.com/Yan-Bin-Lin/nhentai_scroll_slide
// @version      0.1(
// @description  scroll to read picture in nhentai
// @author       Lin Yan Bin
// @match        https://nhentai.net/g/*/*/
// @require      https://code.jquery.com/jquery-3.5.1.min.js
// @grant        none
// ==/UserScript==
(function() {
    let ic = $("#image-container");
    let num = parseInt($("span.num-pages").first().text());
    let img = ic.find("img");
    let src = img.attr("src");
    let base = src.slice(0, src.lastIndexOf("/") + 1);
    let width = img.attr("width");
    let height = img.attr("height");
    let imgs = [];
    for (let i = 1;i <= num; i++){
        imgs.push(base + i.toString() + '.jpg');
    }

    function loadImage(imgs, width, height, target) {
        if (!imgs.length) {
            return;
        }

        let url = imgs.shift();
        $('<img src="'+ url +'">').on("load", function() {
            $(this).width(width).height(height).appendTo(target);
            loadImage(imgs, width, height, target);
        });
    }

    loadImage(imgs, width, height, '#image-container');

})();