Greasy Fork is available in English.

Endless MAL Search Pages

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!

Инсталирай този скрипт?
Препоръчано от автора

Може да харесате и Have we ever talked before? - MAL.

Инсталирай този скрипт
  1. // ==UserScript==
  2. // @name Endless MAL Search Pages
  3. // @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!
  4. // @version 24
  5. // @author hacker09
  6. // @namespace Endless MAL
  7. // @match https://myanimelist.net/featured
  8. // @match https://myanimelist.net/*/genre/*
  9. // @match https://myanimelist.net/profile/*
  10. // @match https://myanimelist.net/users.php*
  11. // @match https://myanimelist.net/clubs.php*
  12. // @match https://myanimelist.net/anime.php?*
  13. // @match https://myanimelist.net/manga.php?*
  14. // @match https://myanimelist.net/people.php*
  15. // @match https://myanimelist.net/reviews.php*
  16. // @match https://myanimelist.net/*/*/*/forum*
  17. // @match https://myanimelist.net/topanime.php*
  18. // @match https://myanimelist.net/topmanga.php*
  19. // @match https://myanimelist.net/character.php*
  20. // @match https://myanimelist.net/forum/?board=*
  21. // @match https://myanimelist.net/forum/?subboard=*
  22. // @match https://myanimelist.net/featured/tag/*
  23. // @match https://myanimelist.net/*/*/*/reviews*
  24. // @match https://myanimelist.net/mymessages.php*
  25. // @match https://myanimelist.net/forum/?clubid=*
  26. // @match https://myanimelist.net/forum/?animeid=*
  27. // @match https://myanimelist.net/anime/producer/*
  28. // @match https://myanimelist.net/manga/magazine/*
  29. // @match https://myanimelist.net/watch/promotion*
  30. // @match https://myanimelist.net/forum/?topicid=*
  31. // @match https://myanimelist.net/comments.php?id=*
  32. // @match https://myanimelist.net/*/*/*/stats?m=all*
  33. // @match https://myanimelist.net/comtocom.php?id1=*
  34. // @include https://myanimelist.net/anime/*/*/userrecs
  35. // @match https://myanimelist.net/mymessages.php?go=sent*
  36. // @match https://myanimelist.net/featured/search?cat=featured&q=*
  37. // @match https://myanimelist.net/recommendations.php?s=recentrecs&t=*
  38. // @match https://myanimelist.net/stacks/search*
  39. // @exclude https://myanimelist.net/anime.php?id=*
  40. // @exclude https://myanimelist.net/people.php?id=*
  41. // @exclude https://myanimelist.net/*/*/*/forum?p=*
  42. // @exclude https://myanimelist.net/*/*/*/reviews?p=*
  43. // @exclude https://myanimelist.net/clubs.php?action=*
  44. // @exclude https://myanimelist.net/*/*/friends?offset=*
  45. // @exclude https://myanimelist.net/profile/*/reviews?p=*
  46. // @exclude https://myanimelist.net/watch/promotion/popular
  47. // @exclude https://myanimelist.net/reviews.php?st=mosthelpful
  48. // @exclude https://myanimelist.net/mymessages.php?go=read&id=*
  49. // @exclude https://myanimelist.net/profile/*/recommendations?p=*
  50. // @exclude https://myanimelist.net/mymessages.php?go=send&toname=*
  51. // @exclude https://myanimelist.net/mymessages.php?go=send&replyid=*
  52. // @require https://cdnjs.cloudflare.com/ajax/libs/findAndReplaceDOMText/0.4.6/findAndReplaceDOMText.min.js
  53. // @icon https://t3.gstatic.com/faviconV2?client=SOCIAL&type=FAVICON&fallback_opts=TYPE,SIZE,URL&url=http://myanimelist.net&size=64
  54. // @grant GM_registerMenuCommand
  55. // @run-at document-end
  56. // @grant GM_setValue
  57. // @grant GM_getValue
  58. // ==/UserScript==
  59.  
  60. (function() {
  61. 'use strict';
  62. var Element;
  63. var nextpage;
  64. var pagenum = 1;
  65. var increaseby = 1;
  66. var nextpagenum = 1;
  67. var page = '&show=';
  68. var callFunction = true;
  69. var href = location.href;
  70. var pagenumincreaseby = 1;
  71. var url = window.location.pathname.split('/');
  72. var numberofthenextpage = document.createElement("center");
  73. //******************************************************************************************************************
  74. if (url[4] === "userrecs") {
  75. if (url[1] === 'anime') {
  76. var Text = 'PTW';
  77. } else {
  78. var Text = 'PTR';
  79. }
  80.  
  81. document.querySelector("div.border_solid").insertAdjacentHTML('beforeend', "<br><input type='checkbox' class='filterbox1'><label style='font-weight: normal;font-size: 10px;'>Hide Recommendations that you doesn't have on your list. (Show " + Text + ":</label><input type='checkbox' class='filterbox2' disabled><label style='font-weight: normal; font-size: 10px;'>)</label>");
  82.  
  83. document.querySelector("input.filterbox1").onclick = function() {
  84. if (document.querySelector("input.filterbox1").checked) {
  85. document.querySelector("input.filterbox2").disabled = false;
  86. Array.from(document.querySelectorAll('a.Lightbox_AddEdit[class*="button_add"],a.Lightbox_AddEdit[class*="plantowatch"]')).forEach(link => link.parentElement.parentElement.parentElement.parentElement.parentElement.parentElement.style.display = 'none');
  87. } else {
  88. document.querySelector("input.filterbox2").disabled = true;
  89. setTimeout(function() {
  90. if (!document.querySelector("input.filterbox1").checked) {
  91. document.querySelector("input.filterbox2").checked = false;
  92. }
  93. }, 1000);
  94. Array.from(document.querySelectorAll('a.Lightbox_AddEdit[class*="button_add"],a.Lightbox_AddEdit[class*="plantowatch"]')).forEach(link => link.parentElement.parentElement.parentElement.parentElement.parentElement.parentElement.style.display = '');
  95. }
  96. };
  97.  
  98. setTimeout(function() {
  99. if (document.querySelector("a.header-profile-link").innerText === 'hacker09') {
  100. document.querySelector("input.filterbox1").click();
  101. }
  102. }, 2500);
  103.  
  104. document.querySelector("input.filterbox2").onclick = function() {
  105. if (document.querySelector("input.filterbox2").checked) {
  106. Array.from(document.querySelectorAll('a.Lightbox_AddEdit[class*="plantowatch"]')).forEach(link => link.parentElement.parentElement.parentElement.parentElement.parentElement.parentElement.style.display = '');
  107. } else {
  108. Array.from(document.querySelectorAll('a.Lightbox_AddEdit[class*="plantowatch"]')).forEach(link => link.parentElement.parentElement.parentElement.parentElement.parentElement.parentElement.style.display = 'none');
  109. }
  110. };
  111.  
  112. }
  113.  
  114. //******************************************************************************************************************
  115. if (url[1] === 'anime.php' || url[1] === 'manga.php' || url[2] === 'genre' || url[2] === 'producer' || url[2] === 'magazine' || url[1] === 'topanime.php' || url[1] === 'topmanga.php' && href !== 'https://myanimelist.net/anime.php') {
  116. var CorrectPages = true;
  117.  
  118. if (url[1] === 'anime.php' || url[2] === 'genre' || url[2] === 'producer' || url[1] === 'topanime.php' || url[1] === 'topmanga.php') {
  119. var Text = 'PTW';
  120. } else {
  121. var Text = 'PTR';
  122. }
  123.  
  124. if (url[1] === 'anime.php' || url[1] === 'manga.php' || url[2] === 'genre' || url[2] === 'producer' || url[2] === 'magazine') {
  125. var Selector = document.querySelectorAll('div[class*="normal_header"]')[1];
  126. var Position = "beforeend";
  127. }
  128.  
  129. if (url[1] === 'topanime.php' || url[1] === 'topmanga.php') {
  130. Selector = document.querySelector("span.fs10.fw-n.ff-Verdana.di-ib.ml16");
  131. Position = "afterend";
  132. }
  133.  
  134. Selector.insertAdjacentHTML(Position, '<br><input type="checkbox" class="filterbox1"><label style="font-weight: normal;font-size: 10px;">Hide Search Results that you have on your list. (Show ' + Text + ':</label><input type="checkbox" class="filterbox2" disabled><label style="font-weight: normal; font-size: 10px;">)</label>');
  135. document.querySelector("input.filterbox1").onclick = function() {
  136. if (document.querySelector("input.filterbox1").checked) {
  137. document.querySelector("input.filterbox2").disabled = false;
  138. Array.from(document.querySelectorAll('a.Lightbox_AddEdit[class*="dropped"],a.Lightbox_AddEdit[class*="completed"],a.Lightbox_AddEdit[class*="watching"],a.Lightbox_AddEdit[class*="on-hold"],a.Lightbox_AddEdit[class*="plantowatch"]')).forEach(link => document.querySelector("div.js-categories-seasonal.js-block-list.tile.mt16") === null ? Element = link.parentElement.parentElement.style.display = 'none' : Element = link.parentElement.parentElement.parentElement.style.display = 'none');
  139. } else {
  140. document.querySelector("input.filterbox2").disabled = true;
  141. setTimeout(function() {
  142. if (!document.querySelector("input.filterbox1").checked) {
  143. document.querySelector("input.filterbox2").checked = false;
  144. }
  145. }, 1000);
  146. Array.from(document.querySelectorAll('a.Lightbox_AddEdit[class*="dropped"],a.Lightbox_AddEdit[class*="completed"],a.Lightbox_AddEdit[class*="watching"],a.Lightbox_AddEdit[class*="on-hold"],a.Lightbox_AddEdit[class*="plantowatch"]')).forEach(link => document.querySelector("div.js-categories-seasonal.js-block-list.tile.mt16") === null ? link.parentElement.parentElement.style.display = '' : link.parentElement.parentElement.parentElement.style.display = '');
  147. }
  148. };
  149.  
  150. document.querySelector("input.filterbox2").onclick = function() {
  151. if (document.querySelector("input.filterbox2").checked) {
  152. Array.from(document.querySelectorAll('a.Lightbox_AddEdit[class*="plantowatch"]')).forEach(link => document.querySelector("div.js-categories-seasonal.js-block-list.tile.mt16") === null ? Element = link.parentElement.parentElement.style.display = '' : Element = link.parentElement.parentElement.parentElement.style.display = '');
  153. } else {
  154. Array.from(document.querySelectorAll('a.Lightbox_AddEdit[class*="plantowatch"]')).forEach(link => document.querySelector("div.js-categories-seasonal.js-block-list.tile.mt16") === null ? Element = link.parentElement.parentElement.style.display = 'none' : Element = link.parentElement.parentElement.parentElement.style.display = 'none');
  155. }
  156. };
  157. //******************************************************************************************************************
  158. GM_registerMenuCommand("Click To Toggle The Add Button Action", AddBTNAction);
  159.  
  160. if (GM_getValue("AddBTN_UseIframes") !== true && GM_getValue("AddBTN_UseIframes") !== false) {
  161. GM_setValue("AddBTN_UseIframes", true);
  162. }
  163.  
  164. function AddBTNAction() {
  165. if (GM_getValue("AddBTN_UseIframes") === false) {
  166. GM_setValue("AddBTN_UseIframes", true);
  167. alert('The Add Button Action Will Follow The Default MAL Behavior.\nThe Page Will Be Reloaded.');
  168. location.reload(); //Reload the page
  169. } else {
  170. GM_setValue("AddBTN_UseIframes", false);
  171. alert('The Add Button Will Be Opened On A New Tab.\nThe Page Will Be Reloaded.');
  172. location.reload(); //Reload the page
  173. }
  174. }
  175.  
  176. if (GM_getValue("AddBTN_UseIframes") === false) {
  177. setTimeout(function() {
  178. for (var i = 0; i < document.querySelectorAll('a[class*="Lightbox_AddEdit"]').length; i++) {
  179. document.querySelectorAll('a[class*="Lightbox_AddEdit"]')[i].setAttribute("target", "_blank");
  180. document.querySelectorAll('a[class*="Lightbox_AddEdit"]')[i].parentElement.parentElement.innerHTML = document.querySelectorAll('a[class*="Lightbox_AddEdit"]')[i].parentElement.parentElement.innerHTML;
  181. }
  182. }, 0);
  183. }
  184.  
  185. if (GM_getValue("AddBTN_UseIframes") === true) {
  186. setTimeout(function() {
  187. document.querySelector("#fancybox-wrap").outerHTML = '<div id="fancybox-wrap" style="opacity: 1; width: 1010px; height: 492.95px; top: 8%; left: 12%; position: fixed; display: none;"><div id="fancybox-outer"><div class="fancy-bg" id="fancy-bg-n"></div><div class="fancy-bg" id="fancy-bg-ne"></div><div class="fancy-bg" id="fancy-bg-e"></div><div class="fancy-bg" id="fancy-bg-se"></div><div class="fancy-bg" id="fancy-bg-s"></div><div class="fancy-bg" id="fancy-bg-sw"></div><div class="fancy-bg" id="fancy-bg-w"></div><div class="fancy-bg" id="fancy-bg-nw"></div><div id="fancybox-inner" style="top: 10px; left: 10px; width: 990px; height: 472.95px; overflow: hidden;"><iframe id="fancybox-frame" scrolling="auto"></iframe></div><a id="fancybox-close" style="display: inline;"></a><div id="fancybox-title" class="fancybox-title-outside" style="width: 990px; padding-left: 10px; padding-right: 10px; bottom: -37px;"><span id="fancybox-title-wrap"><span id="fancybox-title-left"></span><span id="fancybox-title-main">Quick add anime to my list</span><span id="fancybox-title-right"></span></span></div></div></div>';
  188. document.querySelector("#fancybox-close").onclick = function() {
  189. document.querySelector("#fancybox-overlay").style.display = 'none';
  190. document.querySelector("#fancybox-wrap").style.display = 'none';
  191. };
  192. }, 0);
  193.  
  194. for (var i = 0; i < document.querySelectorAll('a[class*="Lightbox_AddEdit"]').length; i++) {
  195. document.querySelectorAll('a[class*="Lightbox_AddEdit"]')[i].setAttribute("target", "fancybox-frame");
  196. document.querySelectorAll('a[class*="Lightbox_AddEdit"]')[i].onclick = function() {
  197. document.querySelector("#fancybox-frame").src = this.href;
  198. setTimeout(function() {
  199. document.querySelector("#fancybox-wrap").style.display = 'block';
  200. }, 500);
  201. document.querySelector("#fancybox-overlay").setAttribute("style", 'background-color: rgb(102, 102, 102); opacity: 0.3; display: block;');
  202. return false;
  203. };
  204. }
  205. }
  206. }
  207. //******************************************************************************************************************
  208. numberofthenextpage.setAttribute("style", "font-size:14px;");
  209. if (document.querySelector('div.mauto.clearfix.pt24') !== null) document.querySelector('div.mauto.clearfix.pt24').style.width = null;
  210.  
  211. if (url[1] === 'users.php')(increaseby = 24, nextpagenum = 0);
  212. if (href.match("&t=members"))(increaseby = 36, nextpagenum = 0);
  213. if (url[1] === 'recommendations.php')(increaseby = 100, nextpagenum = 0);
  214. if (href.match('myanimelist.net\/(?:[^\/]+\/){2}friends'))(page = '?offset=', increaseby = 100, nextpagenum = 0);
  215. if (url[1] === 'character.php' || url[1] === 'people.php' && href.match("\\?letter="))(increaseby = 50, nextpagenum = 0);
  216. if ((url[2] === 'genre' || url[2] === 'producer' || url[2] === 'magazine') && !(href.match("\\?page=")))(page = '?page=');
  217. if (url[1] === 'topanime.php' || url[1] === 'topmanga.php' && href.match("type"))(page = '&limit=', increaseby = 50, nextpagenum = 0);
  218. if (href.match("featured/search") || href.match("stacks/search") || href.match("clubs.php\\?sort=") || href.match("clubs.php\\?cat=") || url[1] === 'reviews.php' && !href.match("&t=members"))(page = '&p=');
  219. if (href.match("stacks/search") && !href.match("search\\?"))(page = '?p=', nextpagenum = 1);
  220. if (url[1] === 'anime.php' || url[1] === 'manga.php' || href.match("clubid=") || href.match("forum/\\?board=") || href.match("forum/\\?subboard=") || href.match("forum/\\?animeid="))(increaseby = 50, nextpagenum = 0);
  221. 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);
  222. 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);
  223. if (href === "https://myanimelist.net/featured" || href.match("featured/tag") || href === "https://myanimelist.net/clubs.php" || url[2] === 'promotion' || url[3] === 'reviews' || url[3] === 'recommendations' || href.match('myanimelist.net\/(?:[^\/]+\/){3}reviews'))(page = '?p=');
  224. var fetchpage = href + page;
  225. if (url[1] === 'mymessages.php')(fetchpage = 'https://myanimelist.net/mymessages.php?go=' + page);
  226. if (url[1] === 'comtocom.php')(fetchpage = document.querySelector("a.ml8").href, nextpagenum = '#');
  227. if (href.match("clubs.php\\?cid="))(fetchpage = document.querySelector("a[href*='comments']").href + page, document.querySelector("div[style='padding-left: 7px;']").setAttribute("style", "height: 2800px; overflow: scroll;)"));
  228. if (href.match("mymessages.php\\?go=sent"))(fetchpage = 'https://myanimelist.net/mymessages.php?go=sent' + page);
  229. if (href.match("stats\\?m=all#members")) {
  230. fetchpage = href.replace("#members", '' + page), increaseby = 75, nextpagenum = 0;
  231. }
  232. if ((url[2] === 'genre' || url[2] === 'producer' || url[2] === 'magazine') && (href.match("\\?page=")))(fetchpage = href.split('?page=')[0] + '?page=', nextpagenum = pagenum = parseInt(href.split('?page=')[1]));
  233. if (href.match('myanimelist.net\/(?:[^\/]+\/){3}forum'))(fetchpage = document.querySelector("a[href*='animeid']").href + page, increaseby = 50, nextpagenum = 0);
  234. 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;"));
  235. if (href.match("\\?topicid=")) {
  236. if (href.match('&show=') !== null) {
  237. nextpagenum = parseInt(href.split('&show=')[1]);
  238. pagenum = nextpagenum / 50 + 1;
  239. } else {
  240. nextpagenum = 0;
  241. }
  242. increaseby = 50, fetchpage = href.split('&show=')[0].split('#')[0] + page;
  243.  
  244. GM_registerMenuCommand("Enable/Disable On Forum Topics", ForumTopicsAction);
  245. if (GM_getValue("Activate_EndlessMalOnForumTopics") !== true && GM_getValue("Activate_EndlessMalOnForumTopics") !== false) {
  246. GM_setValue("Activate_EndlessMalOnForumTopics", true);
  247. }
  248.  
  249. function ForumTopicsAction() {
  250. if (GM_getValue("Activate_EndlessMalOnForumTopics") === false) {
  251. GM_setValue("Activate_EndlessMalOnForumTopics", true);
  252. alert('Endless MAL will run on Forum Pages.\nThe Page Will Be Reloaded.');
  253. location.reload(); //Reload the page
  254. } else {
  255. GM_setValue("Activate_EndlessMalOnForumTopics", false);
  256. alert("Endless MAL WON'T run on Forum Pages.\nThe Page Will Be Reloaded.");
  257. location.reload(); //Reload the page
  258. } //Finishes the else condition
  259. } //Finishes the function
  260. }; //Finishes the if condition
  261.  
  262. async function requestNextPage() //Creates a function to get the next page
  263. { //Starts the function
  264. nextpagenum += increaseby;
  265. pagenum += pagenumincreaseby;
  266. const response = await fetch(fetchpage + nextpagenum); //Fetch
  267. const html = await response.text(); //Gets the fetch response
  268. const newDocument = new DOMParser().parseFromString(html, 'text/html'); //Parses the fetch response
  269.  
  270. numberofthenextpage.innerHTML = '■■■■■■■■■■■■■■■■■■■■■■■■■■■■ Page ' + pagenum + ' ■■■■■■■■■■■■■■■■■■■■■■■■■■■■';
  271.  
  272. if (url[3] === 'reviews') {
  273. document.querySelector("td.pl8").append(numberofthenextpage);
  274. nextpage = newDocument.querySelector('td.pl8');
  275. nextpage.querySelector('div#horiznav_nav').remove();
  276. document.querySelector("td.pl8").append(nextpage);
  277. for (var i = $("a:contains('Previous')").length; i--;) {
  278. $("a:contains('Previous')")[i].remove();
  279. }
  280. for (var i = $("a:contains('More Reviews')").length; i--;) {
  281. $("a:contains('More Reviews')")[i].remove();
  282. }
  283. }
  284. if (url[2] === 'promotion') {
  285. document.querySelector('div.pagination.pagination-numbers.di-b.ac').append(numberofthenextpage);
  286. nextpage = newDocument.querySelector('div.watch-anime-list.watch-video.ml12.clearfix');
  287. document.querySelector('div.pagination.pagination-numbers.di-b.ac').append(nextpage);
  288. }
  289. if (url[1] === 'featured') {
  290. document.querySelector('div.news-list').append(numberofthenextpage);
  291. nextpage = newDocument.querySelector('div.news-list');
  292. document.querySelector('div.news-list').append(nextpage);
  293. }
  294. if (url[1] === 'users.php') {
  295. document.querySelectorAll('div.spaceit')[1].append(numberofthenextpage);
  296. nextpage = newDocument.querySelectorAll('table')[1];
  297. document.querySelectorAll('div.spaceit')[1].append(nextpage);
  298. }
  299. if (GM_getValue("Activate_EndlessMalOnForumTopics") === true && href.match("\\?topicid=") && document.querySelector("div.fl-r.pb4").textContent !== '') {
  300.  
  301. if (document.querySelectorAll("div[style*='height: 15px; margin: 5px 0px;']")[pagenum - 2].innerText.search("»") > -1) //If the fetched page number has the next page '»' symbol
  302. { //Starts the if condition
  303. document.querySelector('div.mauto.clearfix.pt24').append(numberofthenextpage);
  304. nextpage = newDocument.querySelector("#content");
  305. } //Finishes the if condition
  306. else //If the fetched page number doesn't have the next page '»' symbol
  307. {
  308. callFunction = false; //Stop the script
  309. }
  310.  
  311. if (response.status === 200) {
  312. nextpage.querySelector("div.clearfix.mt4").remove();
  313. nextpage.querySelector("div.clearfix.pt4.pb8").remove();
  314. nextpage.querySelector("div.mt4.mb4.pl0.pb0.pt4.pb4").remove();
  315. if (document.querySelector("div.forum_category").innerText.match('Poll') !== null) {
  316. nextpage.querySelector("div.forum_category").remove();
  317. nextpage.querySelector("div.forum_boardrow1").remove();
  318. }
  319. }
  320. var PastLength = document.querySelectorAll("#showQuickReply").length;
  321. var PastQuoteBTNsLength = document.querySelectorAll("a.js-forum-quote-button").length;
  322. document.querySelector('div.mauto.clearfix.pt24').append(nextpage);
  323. setTimeout(function() {
  324. for (let i = PastLength; i < document.querySelectorAll("#showQuickReply").length; i++) {
  325. document.querySelectorAll("#showQuickReply")[i].addEventListener("click", function() {
  326. document.querySelectorAll("#quickReply")[i].style.display = '';
  327. });
  328. document.querySelectorAll("#postReply")[i].addEventListener("click", e => {
  329. setTimeout(function() {
  330. document.querySelectorAll("#quickReply")[i].style.display = "none";
  331. }, 1000);
  332. document.querySelector("#postReply").click();
  333. document.querySelector("#messageText").value = document.querySelectorAll("#messageText")[i].value;
  334. });
  335. document.querySelectorAll("#clearQuickReply")[i].addEventListener("click", function() {
  336. document.querySelectorAll("#messageText")[i].value = '';
  337. });
  338. }
  339. for (let i = PastQuoteBTNsLength; i < document.querySelectorAll("a.js-forum-quote-button").length; i++) {
  340. document.querySelectorAll("a.js-forum-quote-button")[i].addEventListener("click", function() {
  341. var token = document.head.querySelector("[name='csrf_token']").content;
  342. var msgid = document.querySelectorAll("a.js-forum-quote-button")[i].dataset.id;
  343. $("a#showQuickReply").last()[0].click();
  344. $("textarea#messageText.textarea").last()[0].focus();
  345. async function BBCodes() //Creates a function to get the BBCodes
  346. { //Starts the function
  347. const response = await fetch('https://myanimelist.net/includes/quotetext.php', {
  348. "headers": {
  349. "content-type": "application/x-www-form-urlencoded"
  350. },
  351. "body": "msgid=" + msgid + "&csrf_token=" + token + "",
  352. "method": "POST"
  353. }); //Finishes the fetch
  354. const html = await response.text(); //Gets the fetch response
  355. var newDocument = new DOMParser().parseFromString(html, "text/html");
  356. var BBCodes = newDocument.documentElement.textContent;
  357. $("textarea#messageText.textarea").last()[0].value = BBCodes;
  358. } //Finishes the async BBCodes function
  359. BBCodes(); //Starts the BBCodes function
  360. });
  361. }
  362. }, 2000);
  363. }
  364. if (url[1] === 'comtocom.php') {
  365. document.querySelector('div#content').append(numberofthenextpage);
  366. nextpage = newDocument.querySelector('div#content');
  367. fetchpage = newDocument.querySelectorAll("a.ml8")[2].href;
  368. document.querySelector('div#content').append(nextpage);
  369. for (var i = $("a:contains(' Prev')").length; i--;) {
  370. $("a:contains(' Prev')")[i].remove();
  371. }
  372. for (var i = $("a:contains('Next ')").length; i--;) {
  373. $("a:contains('Next ')")[i].remove();
  374. }
  375. }
  376. if (url[1] === 'mymessages.php') {
  377. document.querySelector('div#content').append(numberofthenextpage);
  378. nextpage = newDocument.querySelector('div.message-container');
  379. document.querySelector('div#content').append(nextpage);
  380. findAndReplaceDOMText(document.body, {
  381. find: 'null',
  382. replace: "There's no next page..."
  383. });
  384. }
  385. if (url[3] === 'recommendations') {
  386. document.querySelector("div[style='padding: 0 8px;']").append(numberofthenextpage);
  387. nextpage = newDocument.querySelector("div[style='padding: 0 8px;']");
  388. document.querySelector("div[style='padding: 0 8px;']").append(nextpage);
  389. for (var i = $("a:contains('Previous')").length; i--;) {
  390. $("a:contains('Previous')")[i].remove();
  391. }
  392. for (var i = $("a:contains('More Recommendations')").length; i--;) {
  393. $("a:contains('More Recommendations')")[i].remove();
  394. }
  395. }
  396. if (href.match("clubs.php\\?cid=")) {
  397. document.querySelector("div[style='width: 733px; overflow: hidden;']").append(numberofthenextpage);
  398. nextpage = newDocument.querySelector('div#content');
  399. document.querySelector("div[style='width: 733px; overflow: hidden;']").append(nextpage);
  400. }
  401. if (href.match("stats\\?m=all#members")) {
  402. document.querySelector('table.table-recently-updated').nextElementSibling.append(numberofthenextpage);
  403. nextpage = newDocument.querySelector('table.table-recently-updated');
  404. document.querySelector('table.table-recently-updated').nextElementSibling.append(nextpage);
  405. }
  406. if (href.match('myanimelist.net\/(?:[^\/]+\/){3}forum')) {
  407. document.querySelector("div.page-forum").append(numberofthenextpage);
  408. nextpage = newDocument.querySelector('#forumTopics');
  409. document.querySelector("div.page-forum").append(nextpage);
  410. }
  411. if (href.match('myanimelist.net\/(?:[^\/]+\/){2}friends')) {
  412. document.querySelector("div.majorPad").append(numberofthenextpage);
  413. nextpage = newDocument.querySelector('div.majorPad');
  414. document.querySelector("div.majorPad").append(nextpage);
  415. }
  416. if (href.match('myanimelist.net\/(?:[^\/]+\/){3}reviews')) {
  417. document.querySelector('div.mauto.clearfix.pt24').append(numberofthenextpage);
  418. nextpage = newDocument.querySelector("div.js-scrollfix-bottom-rel");
  419. nextpage.querySelector("#horiznav_nav").remove();
  420. nextpage.querySelector("div.breadcrumb").remove();
  421. nextpage.querySelector("div.border_solid").remove();
  422. nextpage.querySelector("div.reviews-horiznav-nav-sort-block.js-reviews-horiznav-nav-sort-block.mb4.pb8").remove();
  423. document.querySelector('div.mauto.clearfix.pt24').append(nextpage);
  424. for (var i = $("a:contains('Previous')").length; i--;) {
  425. $("a:contains('Previous')")[i].remove();
  426. }
  427. for (var i = $("a:contains('More Reviews')").length; i--;) {
  428. $("a:contains('More Reviews')")[i].remove();
  429. }
  430. }
  431. if (url[1] === 'reviews.php' || url[1] === 'recommendations.php') {
  432. document.querySelector('div.mauto.clearfix.pt24').append(numberofthenextpage);
  433. nextpage = newDocument.querySelector('div#content');
  434. nextpage.querySelector('div.breadcrumb').remove();
  435. nextpage.querySelector('div#horiznav_nav').remove();
  436. document.querySelector('div.mauto.clearfix.pt24').append(nextpage);
  437. }
  438. if (href.match("comments.php\\?id=") || href.match("clubs.php\\?id=")) {
  439. document.querySelector('div#content').append(numberofthenextpage);
  440. nextpage = newDocument.querySelector('div#content');
  441. document.querySelector('div#content').append(nextpage);
  442. }
  443. if (url[1] === 'profile' && url[3] !== 'reviews' && url[3] !== 'recommendations' && url[3] !== 'friends') {
  444. document.querySelector("div.pt16.pb8.ac").append(numberofthenextpage);
  445. nextpage = newDocument.querySelector('div#content');
  446. document.querySelector("div.pt16.pb8.ac").append(nextpage);
  447. }
  448. if (url[1] === 'anime.php' || url[1] === 'manga.php' || url[2] === 'genre' || url[2] === 'producer' || url[2] === 'magazine') {
  449. document.querySelector("[class*='js-block-list']").append(numberofthenextpage);
  450. nextpage = newDocument.querySelector("[class*='js-block-list']");
  451. var ADDBTNPastLength = document.querySelectorAll('a[class*="Lightbox_AddEdit"]').length;
  452. document.querySelector("[class*='js-block-list']").append(nextpage);
  453. }
  454. if (href.match("stacks")) {
  455. document.querySelector('div.search-list').append(numberofthenextpage);
  456. nextpage = newDocument.querySelector('div.search-list');
  457. document.querySelector('div.search-list').append(nextpage);
  458. }
  459. 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/\\?subboard=") || href.match("forum/\\?animeid=")) && (!href.match("clubs.php\\?id=") && !href.match("clubs.php\\?cid="))) {
  460. document.querySelector('div.mauto.clearfix.pt24').append(numberofthenextpage);
  461. nextpage = newDocument.querySelector('table');
  462. document.querySelector('div.mauto.clearfix.pt24').append(nextpage);
  463. }
  464. if (response.status === 404 || document.body.innerText.search("Total Recommendations:") > -1) {
  465. numberofthenextpage.innerHTML = "■■■■■■■■■■■■■■■■■■■■■■■■■■■■ There's no next page... ■■■■■■■■■■■■■■■■■■■■■■■■■■■■";
  466. findAndReplaceDOMText(document.body, {
  467. find: 'null',
  468. replace: " "
  469. });
  470. findAndReplaceDOMText(document.body, {
  471. find: 'undefined',
  472. replace: " "
  473. });
  474. nextpage.innerHTML = " ";
  475. if (document.body.innerText.search("Total Recommendations:") > -1) {
  476. $("div.pt4:contains('Total Recommendations:')")[1].textContent = " ";
  477. }
  478. }
  479. //******************************************************************************************************************
  480. if (CorrectPages) {
  481. if (document.querySelector("input.filterbox1").checked) {
  482. document.querySelector("input.filterbox1").click();
  483. document.querySelector("input.filterbox1").click();
  484. }
  485. if (document.querySelector("input.filterbox2").checked) {
  486. document.querySelector("input.filterbox2").click();
  487. document.querySelector("input.filterbox2").click();
  488. }
  489. if (GM_getValue("AddBTN_UseIframes") === false) {
  490. for (var i = ADDBTNPastLength; i < document.querySelectorAll('a[class*="Lightbox_AddEdit"]').length; i++) {
  491. document.querySelectorAll('a[class*="Lightbox_AddEdit"]')[i].setAttribute("target", "_blank");
  492. }
  493. }
  494. if (GM_getValue("AddBTN_UseIframes") === true) {
  495. for (var i = ADDBTNPastLength; i < document.querySelectorAll('a[class*="Lightbox_AddEdit"]').length; i++) {
  496. document.querySelectorAll('a[class*="Lightbox_AddEdit"]')[i].setAttribute("target", "fancybox-frame");
  497. document.querySelectorAll('a[class*="Lightbox_AddEdit"]')[i].onclick = function() {
  498. document.querySelector("#fancybox-frame").src = this.href;
  499. setTimeout(function() {
  500. document.querySelector("#fancybox-wrap").style.display = 'block';
  501. }, 500);
  502. document.querySelector("#fancybox-overlay").setAttribute("style", 'background-color: rgb(102, 102, 102); opacity: 0.3; display: block;');
  503. return false;
  504. }
  505. }
  506. }
  507. }
  508. //******************************************************************************************************************
  509. } //Finishes the async function
  510.  
  511. window.onscroll = async function() {
  512. var BodyoffsetHeight = document.querySelector('body').offsetHeight;
  513. if (callFunction && window.scrollY * 1.2 >= BodyoffsetHeight - window.innerHeight) {
  514. callFunction = false;
  515. await requestNextPage();
  516. setTimeout(function() {
  517. 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) {
  518. callFunction = false;
  519. } else {
  520. callFunction = true;
  521. }
  522. }, 700);
  523. }
  524. };
  525.  
  526. })();