漫画拼页加载器(hanime1.me)

自动加载 hanime1.me 的所有漫画页面图片,实现拼页效果

K instalaci tototo skriptu si budete muset nainstalovat rozšíření jako Tampermonkey, Greasemonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Userscripts.

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

K instalaci tohoto skriptu si budete muset nainstalovat manažer uživatelských skriptů.

(Už mám manažer uživatelských skriptů, nechte mě ho nainstalovat!)

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.

(Už mám manažer uživatelských stylů, nechte mě ho nainstalovat!)

// ==UserScript==
// @name         漫画拼页加载器(hanime1.me)
// @namespace    http://tampermonkey.net/
// @version      1.0
// @description  自动加载 hanime1.me 的所有漫画页面图片,实现拼页效果
// @match        https://hanime1.me/comic/*
// @grant        none
// @run-at       document-end
// @license MIT
// ==/UserScript==

(window.onload=function () {
    'use strict';

    // 获取漫画信息
const wrapper = document.querySelector('#comic-content-wrapper');
let now = 5;

for (let i = 1; i <= 5; i++) {
  const img = document.createElement('img');
  img.src = `https://i2.nhentai.net/galleries/2955918/${i}.jpg`;
  img.style.width = '100%';
  img.style.marginBottom = '10px';
  wrapper.appendChild(img);
}

  // 懒加载滚动监听
  window.addEventListener('scroll', () => {
      const nearBottom = window.innerHeight + window.scrollY >= document.body.offsetHeight - 100;
      if(nearBottom){
          for (let i = now+1; i <= now+5; i++) {
              const img = document.createElement('img');
              img.src = `https://i2.nhentai.net/galleries/2955918/${i}.jpg`;
              img.style.width = '100%';
              img.style.marginBottom = '10px';
              wrapper.appendChild(img);
          }
          now = now+5;
          console.log('bottom');
      }
  });

})();