Quotes Filter - MAL

Hide quotes from ignored users.

Dovrai installare un'estensione come Tampermonkey, Greasemonkey o Violentmonkey per installare questo script.

You will need to install an extension such as Tampermonkey to install this script.

Dovrai installare un'estensione come Tampermonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Userscripts per installare questo script.

Dovrai installare un'estensione come ad esempio Tampermonkey per installare questo script.

Dovrai installare un gestore di script utente per installare questo script.

(Ho già un gestore di script utente, lasciamelo installare!)

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

(Ho già un gestore di stile utente, lasciamelo installare!)

// ==UserScript==
// @name         Quotes Filter - MAL
// @namespace    https://greasyfork.org/en/users/670188-hacker09?sort=daily_installs
// @version      3
// @description  Hide quotes from ignored users.
// @author       hacker09
// @match        https://myanimelist.net/forum/?topicid=*
// @match        https://myanimelist.net/editprofile.php?go=forumoptions
// @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        GM_setValue
// @grant        GM_listValues
// ==/UserScript==
(function() {
    'use strict';
    if (location.href.match('topicid') === null) //If the user is on the forum settings page
    { //Starts the if condition
        setTimeout(function() {
            document.querySelectorAll("ul.ignored-user-list > li > a:nth-child(2)").forEach(el => GM_setValue(el.innerText, 'Ignored-User')); //Store each ignored user username on tampermonkey
        }, 0);
    } //Finishes the if condition

    if (location.href.match('topicid') !== null) //If the user is on a forum topic
    { //Starts the if condition
        var StoredUsersArray = []; //Creates a new blank array
        GM_listValues().forEach(a => StoredUsersArray.push('^' + a)); //Add all user names on tampermonkey to the array
        if (StoredUsersArray.length > 0) //Check if array is still blank
        { //Starts the if chondition
            const StoredUsersRegex = new RegExp(StoredUsersArray.join('|')); //Create a new variable and regex containing all the values saved on tampermonkey and replace the , separator with the or | regex symbol
            document.querySelectorAll("div.quotetext").forEach(function(el) { //Foreach quote
                if (el.innerText.match(StoredUsersRegex) !== null) //If the current quote matches any user name stored on tampermonkey
                { //Starts the if condition
                    el.remove(); //Remove the quote
                } //Finishes the if condition
            }); //Finishes the foreach condition
        } //Finishes the if condition
    } //Finishes the if condition
})();