Steam游戏详细信息

在Steam商店页面添加一个“查看详细信息”按钮,点击后直接跳转到SteamDB页面

目前为 2024-08-31 提交的版本。查看 最新版本

// ==UserScript==
// @name         Steam游戏详细信息
// @namespace    http://tampermonkey.net/
// @version      1.0
// @description  在Steam商店页面添加一个“查看详细信息”按钮,点击后直接跳转到SteamDB页面
// @author       myncdw
// @match        https://store.steampowered.com/app/*
// @grant        none
// @license MIT
// ==/UserScript==

(function() {
    'use strict';

    // 创建“查看详细信息”按钮的函数
    function createJumpButton() {
        const button = document.createElement('a');
        button.className = 'btn_green_steamui btn_medium';
        button.style.marginLeft = '5px'; // 减少边距使按钮靠得更近
        button.target = '_blank'; // 设置为在新标签页中打开

        const currentUrl = window.location.href;
        const appIdMatch = currentUrl.match(/\/app\/(\d+)/);
        if (appIdMatch) {
            const appId = appIdMatch[1];
            const steamDbUrl = `https://steamdb.info/app/${appId}`;
            button.href = steamDbUrl; // 将按钮的href设置为SteamDB的URL
        }

        const span = document.createElement('span');
        span.textContent = '查看详细信息';
        button.appendChild(span);

        // 将按钮添加到具有“btn_addtocart”类的div中
        const addToCartDiv = document.querySelector('.btn_addtocart');
        if (addToCartDiv) {
            addToCartDiv.appendChild(button);
        }
    }

    // 页面加载时创建按钮
    createJumpButton();
})();

QingJ © 2025

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