GAMES4U.ORG Quick Access Button for Steam

Instantly access GAMES4U.ORG for game-related information and resources directly from Steam's purchase section.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         GAMES4U.ORG Quick Access Button for Steam
// @version      1.0
// @description  Instantly access GAMES4U.ORG for game-related information and resources directly from Steam's purchase section.
// @match        https://store.steampowered.com/app/*
// @icon         https://www.google.com/s2/favicons?domain=steampowered.com
// @grant        GM_xmlhttpRequest
// @homepageURL https://greasyfork.org/en/scripts/511589-games4u-org-quick-access-button-for-steam
// @namespace https://greasyfork.org/users/1290286
// ==/UserScript==

(() => {
    'use strict';

    const headerEl = document.querySelector('.apphub_HeaderStandardTop');
    if (!headerEl) return;

    let itemID = window.location.pathname.split('/')[2];
    let games4uUrl = `https://games4u.org/?s=${itemID}`;

    let el = document.createElement('div');
    el.classList.add('apphub_OtherSiteInfo');
    el.style['margin-left'] = '1rem';

    el.innerHTML = `
    <a class="btnv6_blue_hoverfade btn_medium" href="${games4uUrl}" target="_blank">
        <span>View on GAMES4U.ORG</span>
    </a>
    `;

    const existingEl = document.querySelector('.apphub_OtherSiteInfo');
    if (existingEl) {
        headerEl.insertBefore(el, existingEl);
    } else {
        headerEl.appendChild(el);
    }

})();