meewmeew / Nettruyen auto next chap

// ==UserScript==
// @name         Nettruyen auto next chap
// @namespace    http://github.com/meewmeew/userscripts
// @version      0.0.1
// @description  Auto to press next button when comment block in viewport
// @copyright    2024, MewTheDev (https://mew.id.vn)
// @author       MewTheDev
// @match        https://www.nettruyenvv.com/truyen-tranh/*
// @license      MIT
// @icon         https://www.google.com/s2/favicons?sz=64&domain=nettruyenvv.com
// @grant        none
// ==/UserScript==

(function () {
  'use strict';
  const comment = document.getElementsByClassName('comment')[0]
  const next = document.querySelector('a.btn.btn-danger.next')
  const observer = new window.IntersectionObserver(([entry]) => (entry.isIntersecting) ? next.click() : null, {
    root: null,
    threshold: 0.1,
  })
  observer.observe(comment);
})();