steam库质量净化

此页面https://steamcommunity.com/my/games/?tab=all查看库游戏的质量 游戏全语言总评 及快捷移除功能!(警告!)

当前为 2020-03-24 提交的版本,查看 最新版本

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

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

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         steam库质量净化
// @namespace    http://tampermonkey.net/
// @icon      	https://store.steampowered.com/favicon.ico
// @version      0.8
// @description  此页面https://steamcommunity.com/my/games/?tab=all查看库游戏的质量 游戏全语言总评 及快捷移除功能!(警告!)
// @author       wsz987
// @match        https://steamcommunity.com/id/*
// @match        https://steamcommunity.com/profiles/*
// @require      https://cdn.staticfile.org/jquery/1.12.4/jquery.min.js
// @grant        GM_xmlhttpRequest
// @supportURL   https://keylol.com/t563920-1-1
// ==/UserScript==


(function() {//按钮生成
    'use strict';
    var i=0;
    var Btn = "<div id='reBtn' style='cursor:pointer;z-index:998;position:fixed;text-align: center;left:10px;top:300px;'><img src='https://keylol.com/template/steamcn_metro/src/img/common/icon_with_text_256h.png' height='55' ><br /><span>点击过滤好评及以上的游戏</span></div>";
    var Btn1 = "<div id='reBtn1' style='cursor:pointer;z-index:998;position:fixed;text-align: center;left:10px;top:450px;'><span>过滤褒貶不一及以上的游戏</span></div>";
    $("body").append(Btn,Btn1);
    $('#reBtn').click(function() {
        filter();
    });
    $('#reBtn1').click(function() {
        filter();
        filter1();
    });
    for(i;i<$('.gameListRowItemName').length;i++){
        var id = $(".gameListRow")[i].getAttribute("id").replace(/game_/g, '');
        btn(id,i);
    }
})();

function start(id){    //跨域请求 官方API_info https://partner.steamgames.com/doc/store/localization
    return new Promise(resolve => {
        GM_xmlhttpRequest({
            method: "GET",
            responseType: "json",
            url:"https://store.steampowered.com/appreviews/"+id+"?json=1&language=all&review_type=all&purchase_type=all",
            onload: data=>{
                resolve(data);
            }
        });
    });
};

function json(data){    //JSON数据
    return new Promise((resolve, reject) => {
        var quality,count="";
        if(data.status == "200" &&data.responseText!=="null"){
            if(data.response.success==1){
                var json=data.response.query_summary;
                quality=json.review_score_desc;
                if(json.total_reviews!=0){
                    count="("+json.total_reviews+")";
                }
            }else{
                quality="下架/测试版";
            }
            resolve({quality,count});
        }
    });
}

async function btn(id,i){     //添加game_info
    var arr=await json(await start(id));
    var quality=await arr.quality;
    var count=await arr.count;
    var txt = document.createElement('div');
    txt.className = 'pullup_item';
    txt.id=id;
    txt.innerText=quality+count;
    if(quality=="褒贬不一"||quality=="褒貶不一"||quality=="Mixed"){
        txt.style.color="#B9A074";
    }else if(quality=="特别差评"||quality=="極度負評"||quality=="Very Negative"||quality=="多半差评"||quality=="大多負評"||quality=="Mostly Negative"
            ||quality=="差评"||quality=="負評"){
        txt.style.color="#A34C25";
    };
    txt.onclick =function(){    //跳转客服移除页面
        window.open("https://help.steampowered.com/zh-cn/wizard/HelpWithGameIssue/?appid="+$(this).attr('id')+"&issueid=123&transid=");
        console.log($(this).attr('id'));
    };
    $(".bottom_controls")[i].appendChild(txt);
}

function filter(){
    var i=0;
    for(i;i<$('.gameListRowItemName').length;i++){
        var id=$(".gameListRow")[i].getAttribute("id");
        var str=$("#"+id).text();
        if(str.indexOf("特别好评")>-1 ||str.indexOf("多半好评")>-1||str.indexOf("好评如潮")>-1||str.indexOf("好评")>-1
           ||str.indexOf("壓倒性好評")>-1||str.indexOf("大多好評")>-1||str.indexOf("極度好評")>-1||str.indexOf("好評")>-1
           ||str.indexOf("Mostly Positive")>-1||str.indexOf("Overwhelmingly Positive")>-1||str.indexOf("Positive")>-1 ||str.indexOf("Very Positive")>-1){
            $("#"+id).remove();
        }
    }
}

function filter1(){
    var i=0;
    for(i;i<$('.gameListRowItemName').length;i++){
        var id=$(".gameListRow")[i].getAttribute("id");
        var str=$("#"+id).text();
        if(str.indexOf("褒贬不一")>-1 ||str.indexOf("褒貶不一")>-1||str.indexOf("Mixed")>-1){
            $("#"+id).remove();
        }
    }
}