Steam 评论过滤器

移除Steam商店和Steam社区评论中与游戏无关的评论元素(领导人画像,索要点数等)

当前为 2023-12-13 提交的版本,查看 最新版本

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         Steam 评论过滤器
// @namespace    mopokle
// @version      1.8
// @description  移除Steam商店和Steam社区评论中与游戏无关的评论元素(领导人画像,索要点数等)
// @author       Mopokle
// @match        https://store.steampowered.com/app/*
// @match        https://steamcommunity.com/app/*/reviews*
// @grant        none
// @license      MIT
// @homepage     https://greasyfork.org/zh-CN/scripts/481301
// ==/UserScript==

(function() {
    'use strict';
    // 匹配的短语列表
    // 正则误匹配太多了还是暴力穷举算了
    const unwantedPhrases = ["我是傻", "口了一","帮他口了","帮她口了","领导人画像","请奖励这条评论","心中有党","这么多年都是这个价格",
                             "这里养了一","免费的赞","摸一下","牛子","牛纸","坤坤","KUN KUN","一个赞封","⣿⠿⠶⠙⣿⡟⠡⣴⣿⣽⣿","⣿⣧⠙⠛⠛⡭⠅⠒⠦⠭⣭",
                             "⣿⣿⣿⢛⣵⠇⡇⣿⣿⣿","⣿⣿⣿⣿⣿⣿⣿","给我点赞","涩涩的头像","想要头像","不一样,我喜欢他","牢牢把握一个中心两个基本点",
                             "色色的头像","需要点数","我要点数","steam点数","Steam点数","STEAM点数","点数奖励","免费摸","赞=","点赞摸",
                             "摸赞一次","评论区那些","摸一次","给室友口了","给男朋友口了","给女朋友口了","/` ミ_xノ","牛志节","才给我买",
                             "送礼物V50","牛牛增长","我不一样。我喜欢他","♥♥♥♥♥♥♥♥♥♥♥♥"];

    // 检查评论是否包含不需要的短语
    function containsUnwantedText(commentElement) {
        let commentText = commentElement.textContent || commentElement.innerText;
        return unwantedPhrases.some(phrase => commentText.includes(phrase));
    }

    // 移除函数
    function removeUnwantedComments() {
        // 选择 Steam 商店和社区的选择器
        const storeComments = document.querySelectorAll('.review_box');
        const communityComments = document.querySelectorAll('.apphub_Card');
        const allComments = [...storeComments, ...communityComments];

        allComments.forEach(comment => {
            if (containsUnwantedText(comment)) {
                comment.remove();
                //comment.style.border = '2px solid red'; //Debug用高亮
            }
        });
    }

    // 当 DOM 发生变化时执行回调函数
    var callback = function(mutationsList, observer) {
        for(var mutation of mutationsList) {
            if (mutation.type == 'childList') {
                removeUnwantedComments();
            }
        }
    };

    // 创建 MutationObserver 实例以观察 DOM 变化
    var observer = new MutationObserver(callback);
    var config = { childList: true, subtree: true };
    observer.observe(document.body, config);

    removeUnwantedComments();
})();