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

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

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey, Greasemonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

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

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

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

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्क्रिप्ट व्यवस्थापक एक्स्टेंशन इंस्टॉल करावे लागेल.

(माझ्याकडे आधीच युझर स्क्रिप्ट व्यवस्थापक आहे, मला इंस्टॉल करू द्या!)

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

(माझ्याकडे आधीच युझर स्टाईल व्यवस्थापक आहे, मला इंस्टॉल करू द्या!)

// ==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');
      }
  });

})();