移除“坟贴勿回” for Bangumi

自动隐藏包含特定关键词的垃圾回复(同时包含“坟”、“贴”、“勿”、“回”且总字数少于50)

// ==UserScript==
// @name         移除“坟贴勿回” for Bangumi
// @version      1.1
// @description  自动隐藏包含特定关键词的垃圾回复(同时包含“坟”、“贴”、“勿”、“回”且总字数少于50)
// @author       shironegi
// @match        https://bgm.tv/*
// @match        https://chii.in/*
// @match        https://bangumi.tv/*
// @grant        none
// @license      MIT
// @namespace    https://greasyfork.org/users/1387362
// ==/UserScript==

(function() {
    'use strict';
    function hideReplies() {
        let comments = document.querySelectorAll('#comment_list .row_reply');
        comments.forEach(comment => {
            let message = comment.querySelector('.message');
            if (message) {
                let text = message.textContent;
                if (text.length < 50 &&
                    text.includes('坟') &&
                    text.includes('贴') &&
                    text.includes('勿') &&
                    text.includes('回')) {
                    comment.style.display = 'none';
                }
            }
        });
    }
    hideReplies();
    let observer = new MutationObserver(hideReplies);
    observer.observe(document.body, { childList: true, subtree: true });
})();