Greasy Fork is available in English.

Show More Forum Discussions on Anime/Manga Pages

Show More Forum Discussions on Anime and Manga Pages

Pasang skrip ini?
Sugesti pemilik skrip

Kamu mungkin juga suka Show Anime Duration With Seconds.

Pasang skrip ini
// ==UserScript==
// @name         Show More Forum Discussions on Anime/Manga Pages
// @namespace    ShowMoreDiscussions
// @version      0.3
// @description  Show More Forum Discussions on Anime and Manga Pages
// @author       hacker09
// @include      /^https:\/\/myanimelist\.net\/anime\/[\d]+(\/.*)?/
// @include      /^https:\/\/myanimelist\.net\/manga\/[\d]+(\/.*)?/
// @run-at       document-end
// @grant        none
// ==/UserScript==

(function() {
  'use strict';
  var url = $( "a:contains('Forum')" )[1];
  async function GetMoreDiscussions() //Creates a function to get the morediscussions
  { //Starts the function
    const response = await fetch(url); //Fetch
    const html = await response.text(); //Gets the fetch response
    const newDocument = new DOMParser().parseFromString(html, 'text/html'); //Parses the fetch response
    var content = newDocument.querySelector("div.page-forum"); //Creates a variable to hold the more discussions

    function findTheMoreDiscussionsaElement() {const headers = [...document.querySelectorAll("a")]; //Select all h2 elements on MAL
        return headers.find(a => a.textContent === "More discussions");} //Find the h2 element that has the text Recent Forum Discussion
    findTheMoreDiscussionsaElement();
    findTheMoreDiscussionsaElement().remove(); //Remove the a element text
    function findTheRecentForumFiscussionheader() {const headers = [...document.querySelectorAll("h2")]; //Select all h2 elements on MAL
        return headers.find(h2 => h2.textContent === "Recent Forum Discussion");} //Find the h2 element that has the text Recent Forum Discussion
    findTheRecentForumFiscussionheader();

    document.querySelector("div.page-forum").appendChild(content); //append more discussions content on the Recent Forum Discussion
    findTheRecentForumFiscussionheader().innerHTML = " "; //Remove the header text
    document.querySelector("#forumTopics").remove(); //Remove the discussions
  } //Finishes the async function
  GetMoreDiscussions(); //Starts the function
})();