Greasy Fork

Greasy Fork is available in English.

Steam显示英文游戏名

在商店页显示双语游戏名称,点击名称可以复制。

当前为 2021-09-08 提交的版本,查看 最新版本

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         Show_English_Name
// @name:zh-CN   Steam显示英文游戏名
// @namespace    https://blog.chrxw.com
// @version      1.1
// @description  在商店页显示双语游戏名称,点击名称可以复制。
// @description:zh-CN  在商店页显示双语游戏名称,点击名称可以复制。
// @author       Chr_
// @include      /https://store\.steampowered\.com\/app\/\d+/
// @require      http://greasyfork.icu/scripts/431423-async-requests/code/Async_Requests.js
// @connect      store.steampowered.com
// @license      AGPL-3.0
// @icon         https://blog.chrxw.com/favicon.ico
// @grant        GM_setClipboard
// @grant        GM_xmlhttpRequest
// ==/UserScript==


(() => {
    'use strict';

    let appid = (window.location.pathname.match(/\/app\/(\d+)/) ?? [null, null])[1];

    if (appid === null) { return; }

    $http.getText(`https://store.steampowered.com/app/${appid}/?l=english`).then(html => {
        let en_title = (html.match(/<title>([\s\S]+)<\/title>/) ?? [, ''])[1];

        en_title = en_title.replace(/ on Steam$/, '');

        let t = setInterval(() => {
            let ele = document.getElementById('appHubAppName');
            if (ele != null) {
                clearInterval(t);
                let raw_title = ele.textContent
                if (raw_title.toLowerCase() != en_title.toLowerCase()) {
                    ele.textContent = `${raw_title} (${en_title})`;
                    ele.title = '点击复制';
                }
                ele.addEventListener('click', () => {
                    GM_setClipboard(ele.textContent, { type: 'text', mimetype: 'text/plain' });
                });
            }
        }, 500);
    });
})();