Friend Requests Fix - MAL

Shows a next page button on your friends requests history, and let's you see all friends requests you got up to 3 years ago.

安装此脚本
作者推荐脚本

您可能也喜欢"Not Yet Aired" Hider

安装此脚本

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         Friend Requests Fix - MAL
// @namespace    https://greasyfork.org/en/users/670188-hacker09?sort=daily_installs
// @version      7
// @description  Shows a next page button on your friends requests history, and let's you see all friends requests you got up to 3 years ago.
// @author       hacker09
// @match        https://myanimelist.net/notification/friend_request*
// @icon         https://t3.gstatic.com/faviconV2?client=SOCIAL&type=FAVICON&fallback_opts=TYPE,SIZE,URL&url=http://myanimelist.net&size=64
// @run-at       document-end
// @grant        none
// ==/UserScript==
(function() {
  'use strict';
  window.onload = setTimeout(() => {
    if (location.href.match('history') === null) //If the user is not on a next page already
    { //Starts the if condition
      document.querySelectorAll("div.notification-pagination")[1].insertAdjacentHTML('BeforeEnd', `<span><i class="fa-solid fa-chevron-left"></i> Prev</span> <a href="https://myanimelist.net/notification/friend_request/history?p=1">View more</a>`); //Add the next page button
    } //Finishes the if condition
    else //If the user is on a next page already
    { //Starts the else condition

      var link = `https://myanimelist.net/notification/friend_request/history?p=${parseInt(location.search.match(/\d+/)[0])-1}`; //Suppose the user is not on page 1
      if (location.href.match(/p=1$/) !== null) //If the user is on page 1
      { //Starts the if condition
        link = 'https://myanimelist.net/notification/friend_request'; //Change the link to the first page
      } //Finishes the if condition

      document.querySelector("div.notification-pagination").insertAdjacentHTML('AfterEnd', `<div class="notification-pagination"><a href="${link}"><i class="fa-solid fa-chevron-left"></i> Prev<a href="https://myanimelist.net/notification/friend_request/history?p=${parseInt(location.search.match(/\d+/)[0])+1}">Next <i class="fa-solid fa-chevron-right"></i></a></div>`); //Add the next page button
      document.querySelector("div.notification-pagination").remove(); //Remove the old page buttons
    } //Finishes the else condition
  }, "500");
})();