Quotes Filter - MAL

Hide quotes from ignored users.

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==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
})();