Add ProtonDB Status to Steam store page

Add a badge of ProtonDB Status to Steam store page with shields.io. (Inspired by: https://github.com/tryton-vanmeer/ProtonDB-for-Steam)

目前为 2021-05-01 提交的版本。查看 最新版本

// ==UserScript==
// @name         Add ProtonDB Status to Steam store page
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  Add a badge of ProtonDB Status to Steam store page with shields.io. (Inspired by: https://github.com/tryton-vanmeer/ProtonDB-for-Steam)
// @author       eggplants
// @homepage     https://github.com/eggplants
// @match        *://store.steampowered.com/app/*
// @grant        none
// @license      MIT
// ==/UserScript==

/*jshint esversion: 6 */

(function() {
'use strict';

var D = document;

const appid = D.querySelector("meta[property='og:url']").content.split('/')[4];
const badgeHref = 'https://www.protondb.com/app/' + appid;
const badgeSrc = `https://img.shields.io/badge/dynamic/json.svg\
?uri=https://www.protondb.com/api/v1/reports/summaries/${appid}.json\
&query=$.trendingTier\
&label=ProtonDB\
&colorB=e3e3e3\
&style=flat-square`;

function createElementFromHTML(htmlString) {
    var div = document.createElement('div');
    div.innerHTML = htmlString.trim();
    return div.firstChild;
}

const protonElm = createElementFromHTML(`
<div class="proton_status">
    <div class="subtitle column">ProtonDB:</div>
    <div class="status">
        <a href="${badgeHref}">
            <img src="${badgeSrc}" />
        </a>
    </div>
</div>`);

user=D.querySelector('div.user_reviews');
user.appendChild(protonElm);

})();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址