Endless Search/Genre Pages On MAL

Load the next page automatically and endlessly. You just need to scroll down to the page bottom. Now there's no need to click on the "next page" button ever again!

当前为 2020-08-25 提交的版本,查看 最新版本

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。

您需要先安装用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name            Endless Search/Genre Pages On MAL
// @description     Load the next page automatically and endlessly. You just need to scroll down to the page bottom. Now there's no need to click on the "next page" button ever again!
// @author          hacker09
// @namespace       Endless MAL
// @include         https://myanimelist.net/anime.php?*
// @include         https://myanimelist.net/manga.php?*
// @include         https://myanimelist.net/anime/genre/*
// @include         https://myanimelist.net/manga/genre/*
// @run-at          document-end
// @version         0.0.1
// ==/UserScript==

(function() {
    'use strict';
    var newDocument;
    if ((window.location.pathname.split('/')[1] === 'anime.php' || window.location.pathname.split('/')[1] === 'manga.php') && (document.querySelector("div.js-categories-seasonal.js-block-list.list") !== null))
     {
       var nextpagenum = 0;
       var increaseby = 50;
       var fetchpage = location.href+'&show=';
     }
      else
       {
        var nextpagenum = 1;
        var increaseby = 1;
        var fetchpage = location.href+'?page=';
       }
    async function requestNextPage() //Creates a function to get the next page
    { //Starts the function
      nextpagenum += increaseby;
      const response = await fetch(fetchpage+nextpagenum); //Fetch
      const html = await response.text(); //Gets the fetch response
      const newDocument = new DOMParser().parseFromString(html, 'text/html'); //Parses the fetch response
      if ((window.location.pathname.split('/')[1] === 'anime.php' || window.location.pathname.split('/')[1] === 'manga.php') && (document.querySelector("div.js-categories-seasonal.js-block-list.list") !== null))
     {
        const nextpage = newDocument.querySelector("div.js-categories-seasonal.js-block-list.list");
        document.querySelector("div.js-categories-seasonal.js-block-list.list").append(nextpage);
      }
        else
         {
          const nextpage = newDocument.querySelector("div.ml8.mr8.mt8.mb16.js-block-list.list > table > tbody");
          document.querySelector("table.msh_highlight_parent").append(nextpage);
         }
    } //Finishes the async requestNextPage function

window.onscroll = async function() {
    if ($(window).scrollTop() + $(window).height() == $(document).height()) {
     await requestNextPage();
    }
};
})();