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!
目前為
// ==UserScript==
// @name Endless MAL Search Pages
// @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!
// @version 0.0.7
// @author hacker09
// @namespace Endless MAL
// @match https://myanimelist.net/featured*
// @match https://myanimelist.net/*/genre/*
// @match https://myanimelist.net/profile/*
// @match https://myanimelist.net/clubs.php*
// @match https://myanimelist.net/anime.php?*
// @match https://myanimelist.net/manga.php?*
// @match https://myanimelist.net/people.php*
// @match https://myanimelist.net/reviews.php*
// @match https://myanimelist.net/*/*/*/forum*
// @match https://myanimelist.net/topanime.php*
// @match https://myanimelist.net/topmanga.php*
// @match https://myanimelist.net/character.php*
// @match https://myanimelist.net/forum/?board=*
// @match https://myanimelist.net/*/*/*/reviews*
// @match https://myanimelist.net/mymessages.php*
// @match https://myanimelist.net/forum/?clubid=*
// @match https://myanimelist.net/forum/?animeid=*
// @match https://myanimelist.net/anime/producer/*
// @match https://myanimelist.net/manga/magazine/*
// @match https://myanimelist.net/watch/promotion*
// @match https://myanimelist.net/comments.php?id=*
// @match https://myanimelist.net/*/*/*/stats?m=all*
// @match https://myanimelist.net/users.php?cat=user&q=*
// @match https://myanimelist.net/mymessages.php?go=sent*
// @match https://myanimelist.net/recommendations.php?s=recentrecs&t=*
// @exclude https://myanimelist.net/*/*/*/forum?p=*
// @exclude https://myanimelist.net/*/*/*/reviews?p=*
// @exclude https://myanimelist.net/clubs.php?action=*
// @exclude https://myanimelist.net/*/*/friends?offset=*
// @exclude https://myanimelist.net/profile/*/reviews?p=*
// @exclude https://myanimelist.net/watch/promotion/popular
// @exclude https://myanimelist.net/reviews.php?st=mosthelpful
// @exclude https://myanimelist.net/mymessages.php?go=read&id=*
// @exclude https://myanimelist.net/profile/*/recommendations?p=*
// @require https://cdnjs.cloudflare.com/ajax/libs/findAndReplaceDOMText/0.4.6/findAndReplaceDOMText.min.js
// @run-at document-end
// ==/UserScript==
(function() {
'use strict';
var nextpage;
var pagenum = 1;
var increaseby = 1;
var nextpagenum = 1;
var page = '&show=';
var callFunction = true;
var href = location.href;
var pagenumincreaseby = 1;
var url = window.location.pathname.split('/');
var numberofthenextpage = document.createElement("center");
numberofthenextpage.setAttribute("style","font-size:14px;");
if (document.querySelector('div.mauto.clearfix.pt24') !== null) document.querySelector('div.mauto.clearfix.pt24').style.width = null;
if (url[1] === 'users.php') (increaseby = 24,nextpagenum = 0);
if (href.match("&t=members")) (increaseby = 36,nextpagenum = 0);
if (url[1] === 'recommendations.php') (increaseby = 100,nextpagenum = 0);
if (url[2] === 'genre' || url[2] === 'producer' || url[2] === 'magazine') (page = '?page=');
if (href.match('myanimelist.net\/(?:[^\/]+\/){2}friends')) (page = '?offset=',increaseby = 100,nextpagenum = 0);
if (url[1] === 'character.php' || url[1] === 'people.php' && href.match("\\?letter=")) (increaseby = 50,nextpagenum = 0);
if (url[1] === 'topanime.php' || url[1] === 'topmanga.php' && href.match("type")) (page = '&limit=',increaseby = 50,nextpagenum = 0);
if (href.match("featured/search") || href.match("clubs.php\\?sort=") || href.match("clubs.php\\?cat=") || url[1] === 'reviews.php' && !href.match("&t=members")) (page = '&p=');
if (url[1] === 'anime.php' || url[1] === 'manga.php' || href.match("clubid=") || href.match("forum/\\?board=") || href.match("forum/\\?animeid=")) (increaseby = 50,nextpagenum = 0);
if ((url[1] === 'comments.php' || href.match("clubs.php\\?id=") || href.match("clubs.php\\?cid=") || url[1] === 'mymessages.php') && (!href.match("&t=members"))) (increaseby = 20,nextpagenum = 0);
if (href === "https://myanimelist.net/topanime.php" || href === "https://myanimelist.net/topmanga.php" || href === "https://myanimelist.net/character.php" || href === "https://myanimelist.net/people.php") (page = '?limit=',increaseby = 50,nextpagenum = 0);
if (href === "https://myanimelist.net/featured" || href === "https://myanimelist.net/clubs.php" || url[2] === 'promotion' || url[3] === 'reviews' || url[3] === 'recommendations' || href.match('myanimelist.net\/(?:[^\/]+\/){3}reviews')) (page = '?p=');
var fetchpage = href+page;
if (url[1] === 'mymessages.php') (fetchpage = 'https://myanimelist.net/mymessages.php?go='+page);
if (href.match("clubs.php\\?cid=")) (fetchpage = document.querySelector("a[href*='comments']").href+page);
if (href.match("mymessages.php\\?go=sent")) (fetchpage = 'https://myanimelist.net/mymessages.php?go=sent'+page);
if (href.match("stats\\?m=all#members")) {fetchpage = href.replace("#members",''+ page),increaseby = 75,nextpagenum = 0;}
if (href.match('myanimelist.net\/(?:[^\/]+\/){3}forum')) (fetchpage = document.querySelector("a[href*='animeid']").href+page,increaseby = 50,nextpagenum = 0);
if (url[1] === 'profile' && url[3] !== 'reviews' && url[3] !== 'recommendations' && url[3] !== 'friends') (fetchpage = document.querySelector("a[href*='comments']").href+page,increaseby = 20,nextpagenum = 0,document.querySelector("div.pt16.pb8.ac").setAttribute("style", "text-align: left !important;"));
async function requestNextPage() //Creates a function to get the next page
{ //Starts the function
nextpagenum += increaseby;
pagenum += pagenumincreaseby;
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
numberofthenextpage.innerHTML = '■■■■■■■■■■■■■■■■■■■■■■■■■■■■Page ' + pagenum + ' ⬇️■■■■■■■■■■■■■■■■■■■■■■■■■■■■';
if (url[3] === 'reviews') {
document.querySelector("td.pl8").append(numberofthenextpage);
nextpage = newDocument.querySelector('td.pl8');
nextpage.querySelector('div#horiznav_nav').remove();
document.querySelector("td.pl8").append(nextpage);
for (var i = $("a:contains('Previous')").length; i--;) {$("a:contains('Previous')")[i].remove();}
for (var i = $("a:contains('More Reviews')").length; i--;) {$("a:contains('More Reviews')")[i].remove();}
}
if (url[2] === 'promotion') {
document.querySelector('div.pagination.pagination-numbers.di-b.ac').append(numberofthenextpage);
nextpage = newDocument.querySelector('div.watch-anime-list.watch-video.ml12.clearfix');
document.querySelector('div.pagination.pagination-numbers.di-b.ac').append(nextpage);
}
if (url[1] === 'featured') {
document.querySelector('div.news-list').append(numberofthenextpage);
nextpage = newDocument.querySelector('div.news-list');
document.querySelector('div.news-list').append(nextpage);
}
if (url[1] === 'users.php') {
document.querySelectorAll('div.spaceit')[1].append(numberofthenextpage);
nextpage = newDocument.querySelectorAll('table')[1];
document.querySelectorAll('div.spaceit')[1].append(nextpage);
}
if (url[1] === 'mymessages.php') {
document.querySelector('div#content').append(numberofthenextpage);
nextpage = newDocument.querySelector('div.message-container');
document.querySelector('div#content').append(nextpage);
}
if (url[3] === 'recommendations') {
document.querySelector("div[style='padding: 0 8px;']").append(numberofthenextpage);
nextpage = newDocument.querySelector("div[style='padding: 0 8px;']");
document.querySelector("div[style='padding: 0 8px;']").append(nextpage);
for (var i = $("a:contains('Previous')").length; i--;) {$("a:contains('Previous')")[i].remove();}
for (var i = $("a:contains('More Recommendations')").length; i--;) {$("a:contains('More Recommendations')")[i].remove();}
}
if (href.match("clubs.php\\?cid=")) {
document.querySelector("div[style='width: 733px; overflow: hidden;']").append(numberofthenextpage);
nextpage = newDocument.querySelector('div#content');
document.querySelector("div[style='width: 733px; overflow: hidden;']").append(nextpage);
}
if (href.match("stats\\?m=all#members")) {
document.querySelector('table.table-recently-updated').nextElementSibling.append(numberofthenextpage);
nextpage = newDocument.querySelector('table.table-recently-updated');
document.querySelector('table.table-recently-updated').nextElementSibling.append(nextpage);
}
if (href.match('myanimelist.net\/(?:[^\/]+\/){3}forum')) {
document.querySelector("div.page-forum").append(numberofthenextpage);
nextpage = newDocument.querySelector('#forumTopics');
document.querySelector("div.page-forum").append(nextpage);
}
if (href.match('myanimelist.net\/(?:[^\/]+\/){2}friends')) {
document.querySelector("div.majorPad").append(numberofthenextpage);
nextpage = newDocument.querySelector('div.majorPad');
document.querySelector("div.majorPad").append(nextpage);
}
if (href.match('myanimelist.net\/(?:[^\/]+\/){3}reviews')) {
document.querySelector('div.mauto.clearfix.pt24').append(numberofthenextpage);
nextpage = newDocument.querySelector("div.js-scrollfix-bottom-rel");
nextpage.querySelector("#horiznav_nav").remove();
nextpage.querySelector("div.breadcrumb").remove();
nextpage.querySelector("div.border_solid").remove();
nextpage.querySelector("div.reviews-horiznav-nav-sort-block.js-reviews-horiznav-nav-sort-block.mb4.pb8").remove();
document.querySelector('div.mauto.clearfix.pt24').append(nextpage);
for (var i = $("a:contains('Previous')").length; i--;) {$("a:contains('Previous')")[i].remove();}
for (var i = $("a:contains('More Reviews')").length; i--;) {$("a:contains('More Reviews')")[i].remove();}
}
if (url[1] === 'reviews.php' || url[1] === 'recommendations.php') {
document.querySelector('div.mauto.clearfix.pt24').append(numberofthenextpage);
nextpage = newDocument.querySelector('div#content');
nextpage.querySelector('div.breadcrumb').remove();
nextpage.querySelector('div#horiznav_nav').remove();
document.querySelector('div.mauto.clearfix.pt24').append(nextpage);
}
if (href.match("comments.php\\?id=") || href.match("clubs.php\\?id=")) {
document.querySelector('div#content').append(numberofthenextpage);
nextpage = newDocument.querySelector('div#content');
document.querySelector('div#content').append(nextpage);
}
if (url[1] === 'profile' && url[3] !== 'reviews' && url[3] !== 'recommendations' && url[3] !== 'friends') {
document.querySelector("div.pt16.pb8.ac").append(numberofthenextpage);
nextpage = newDocument.querySelector('div#content');
document.querySelector("div.pt16.pb8.ac").append(nextpage);
}
if (url[1] === 'anime.php' || url[1] === 'manga.php' || url[2] === 'genre' || url[2] === 'producer' || url[2] === 'magazine') {
document.querySelector("[class*='js-block-list']").append(numberofthenextpage);
nextpage = newDocument.querySelector("[class*='js-block-list']");
document.querySelector("[class*='js-block-list']").append(nextpage);
}
if ((url[1] === 'clubs.php' || url[1] === 'topanime.php' || url[1] === 'topmanga.php' || url[1] === 'character.php' || url[1] === 'people.php' || href.match("clubid=") || href.match("forum/\\?board=") || href.match("forum/\\?animeid=")) && (!href.match("clubs.php\\?id=") && !href.match("clubs.php\\?cid="))) {
document.querySelector('div.mauto.clearfix.pt24').append(numberofthenextpage);
nextpage = newDocument.querySelector('table');
document.querySelector('div.mauto.clearfix.pt24').append(nextpage);
}
if (document.body.innerText.search("null") > -1)
{
findAndReplaceDOMText(document.body, {find: 'null',replace: "There's no next page..."});
}
if (document.body.innerText.search("Total Recommendations:") > -1)
{
$("div.pt4:contains('Total Recommendations:')")[1].textContent = "There's no next page...";
}
} //Finishes the async function
window.onscroll = async function() {
if (callFunction && window.scrollY * 1.2 >= document.querySelector('body').offsetHeight - window.innerHeight) {
callFunction = false;
await requestNextPage();
setTimeout(function() {
if (document.body.innerText.search("There's no next page...") > -1 || document.body.innerText.search("This user currently has no comments") > -1 || document.body.innerText.search("No reviews were found.") > -1 || document.body.innerText.search("This page doesn't exist.") > -1 || document.body.innerText.search("No friends found :(") > -1 || $("div.pt4:contains('Total Recommendations:')").length > 1) {callFunction = false;} else {callFunction = true;}
}, 700);
}
};
})();