Steam Chinese Mark

mark url contains appid which support chinese & card info

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

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

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         Steam Chinese Mark
// @description  mark url contains appid which support chinese & card info
// @author       desc_inno, wsz987
// @namespace    https://github.com/desc70865/Steam-Chinese-Mark/
// @supportURL   https://github.com/desc70865/Steam-Chinese-Mark/issues
// @version      0.4.2
// @icon         https://keylol.com/favicon.ico
// @match        https://keylol.com/*
// @require      https://cdn.staticfile.org/jquery/1.12.4/jquery.min.js
// @resource     chinese https://raw.githubusercontent.com/desc70865/Steam-Chinese-Mark/master/full.json
// @resource     card https://bartervg.com/browse/cards/json/
// @grant        GM_getResourceText
// ==/UserScript==

(async function() {
    'use strict';
    window.onload = function(){
        var card_json = JSON.parse(GM_getResourceText('card')),
            chinese_json = JSON.parse(GM_getResourceText('chinese'));
        search_appid(card_json, chinese_json);
        jQuery('body').on("click", "#threadindex > div > ul > li",()=>{
            $('.t_f').ready(()=>setTimeout(()=>{search_appid(card_json, chinese_json).then(unauto())},1000))
        });
    }
})();

function search_appid(card_json, chinese_json){
    var color_card = "deeppink",
    color_foo = "darkviolet",
    color_language = "red", // #57BAE8
    fontWeight_new = "bolder"; // normal

    return new Promise(resolve => {
        $('.steam-info-link').each(function(){
            var arr_href = $(this).context.pathname.split('/'),
                kind = arr_href[1],
                appid = arr_href[2];
            if(kind != 'app'){
                if(kind == 'bundle'){
                    $(this).context.text = "[Bundle]: "+ $(this).context.innerText;
                }
                else if(kind == 'sub'){
                    $(this).context.text = "[Sub]: "+ $(this).context.innerText;
                }
                $(this).context.style.color = color_foo;
            }
            else if(card_json[appid] != undefined){
                $(this).context.text = "📇 " + $(this).context.innerText;
                $(this).context.style.color = color_card;
                $(this).context.style.fontWeight = fontWeight_new;
            }
            if(chinese_json[appid] != undefined){
                $(this).context.text = "🀄️ " + $(this).context.innerText;
                $(this).context.style.color = color_language;
                $(this).context.style.fontWeight = fontWeight_new;
            }
        })
    });
}

function unauto(){
    $('.plc div.authi>a[rel=nofollow]').eq(0).after(`<span class="pipe">|</span><a href="javascript:void(0);" id="unauto_tab">标记</a>`);
    $('#unauto_tab').click(()=>search_appid(card_json, chinese_json))
};