Sleazy Fork is available in English.

E-Hentai Infinite Scroll

Auto load next image. Free your hand from keyboard/mouse.

< Відгуки до E-Hentai Infinite Scroll

Відгук: Добре - скрипт працює добре

§
Опубліковано: 04.05.2024

You can make it work with some modifications.

(function() {
'use strict';
const displayArea = document.querySelector('table.itg.glte');
let page = document;
let lock = false;
document.addEventListener('scroll', checkAndLoad, {passive: true});
checkAndLoad();

async function checkAndLoad() {
if (document.body.clientHeight - window.scrollY < window.innerHeight * 4 && !lock) {
lock = true;
page = await loadPage(page);
lock = false;
console.log(page);
}
}
function loadPage(dom) /* Promise: the document of next page */ {
const nextPageA = dom.getElementById('dnext');
if (!nextPageA) return;

return fetch(nextPageA.href)
.then(e => e.text())
.then(rawHtml => {
const parser = new DOMParser();
const newDom = parser.parseFromString(rawHtml, 'text/html');
var datas = newDom.querySelectorAll('td.gl1e, td.gl2e');
var trElements = Array.from(datas).map(function(td) {
return td.parentNode;
});
trElements.forEach((element) => displayArea.appendChild(element));
return newDom;
});
}
})();

§
Опубліковано: 17.05.2024

Fixed to be compatible with the Read History plugin.

(function() {
'use strict';
const displayArea = document.querySelector('table.itg.glte');
let page = document;
let lock = false;
document.addEventListener('scroll', checkAndLoad, {passive: true});
checkAndLoad();

async function checkAndLoad() {
if (document.body.clientHeight - window.scrollY < window.innerHeight * 4 && !lock) {
lock = true;
page = await loadPage(page);
lock = false;
console.log(page);
}
}
function loadPage(dom) /* Promise: the document of next page */ {
const nextPageA = dom.getElementById('dnext');
if (!nextPageA) return;

return fetch(nextPageA.href)
.then(e => e.text())
.then(rawHtml => {
const parser = new DOMParser();
const newDom = parser.parseFromString(rawHtml, 'text/html');
var datas = newDom.querySelector('.itg.glte tbody');
displayArea.appendChild(datas);
return newDom;
});
}
})();

Опублікувати відповідь

Sign in to post a reply.