Sleazy Fork is available in English.

nhentai Auto Scroller

Auto scroll doujinshi and manga on nhentai so you can jerk off all hands-free.

< Feedback on nhentai Auto Scroller

Review: Good - script works

§
Posted: 2023.02.18.

// ==UserScript==
// @name nhentai Auto Scroller
// @namespace http://tampermonkey.net/
// @version 1.0.0
// @description Auto scroll doujinshi and manga on nhentai so you can jerk off all hands-free.
// @author LoliEnjoyer
// @include /^https:\/\/nhentai\.net\/g\/\d+\/\d+\/$/
// ==/UserScript==

const ScrollHandler = {
scrollIntervalID: null,

start: function (speed) {
const scrollStep = 1; // The number of pixels to scroll in each step
const scrollDelay = 7; // The delay time between each step (in milliseconds)
const scrollLimit = document.body.scrollHeight - window.innerHeight; // The maximum amount to scroll

if (this.scrollIntervalID === null) {
this.scrollIntervalID = setInterval(function () {
let scrollPos = window.pageYOffset;
if (scrollPos < scrollLimit) {
window.scrollTo(0, scrollPos + scrollStep);
} else {
clearInterval(this.scrollIntervalID);
this.scrollIntervalID = null;
}
}.bind(this), scrollDelay);
}
},

stop: function () {
if (this.scrollIntervalID !== null) {
clearInterval(this.scrollIntervalID);
this.scrollIntervalID = null;
}
}
};

const div = document.createElement('div');
const button = document.createElement('button');
const icon = document.createElement('i');

let isAutoScroll = false;

function buttonClickAction() {
isAutoScroll = !isAutoScroll;
icon.setAttribute('class', `fa fa-lg ${isAutoScroll ? 'fa-pause' : 'fa-play'}`);
isAutoScroll ? ScrollHandler.start(1) : ScrollHandler.stop();
}

function buttonPosition() {
window.pageYOffset >= 90
? Object.assign(div.style, { position: 'fixed', top: 0 })
: Object.assign(div.style, { position: 'absolute', top: "90px" });
}

button.setAttribute('class', 'btn btn-primary');
icon.setAttribute('class', 'fa fa-lg fa-play');

Object.assign(div.style, { 'z-indez': 100, right: 0, margin: '10px' })
Object.assign(button.style, { width: '46px', height: '46px' })
buttonPosition()
button.appendChild(icon)
div.appendChild(button)
document.body.appendChild(div);

button.addEventListener("click", buttonClickAction);
window.addEventListener("scroll", buttonPosition);

window.addEventListener("scroll", function () {
if ((window.innerHeight + window.pageYOffset >= document.body.scrollHeight) && isAutoScroll) {
ScrollHandler.stop(); // Stop any existing scrolling
ScrollHandler.start(1); // Start scrolling with a speed of 1 pixel per step
}
});

const onMutate = function(mutationsList) {
if (isAutoScroll) {
ScrollHandler.stop(); // Stop any existing scrolling
ScrollHandler.start(1); // Start scrolling with a speed of 1 pixel per step
}
};
const observer = new MutationObserver(onMutate);
observer.observe(document.body, {childList: true, subtree: true});

Post reply

Sign in to post a reply.