您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Shows a shortcut to the user's SteamGifts profile on every Steam profile page.
// ==UserScript== // @name SteamGifts Profile Link on Steam // @namespace https://steamgifts.com // @version 1.0 // @description Shows a shortcut to the user's SteamGifts profile on every Steam profile page. // @author ikigaiDH // @match https://steamcommunity.com/profiles/* // @match https://steamcommunity.com/id/* // @run-at document-end // @grant none // @license GPL-3.0-only // ==/UserScript== (function () { "use strict"; // 1️⃣ Grab SteamID64 directly from /profiles/<id64> URLs const path = window.location.pathname.split("/"); if (path[1] === "profiles" && /^\d{17}$/.test(path[2])) { injectLink(path[2]); return; } // 2️⃣ Look for `"steamid":"7656119…"` in the raw HTML const html = document.documentElement.innerHTML; let m = html.match(/"steamid"\s*:\s*"(\d{17})"/); if (m) { injectLink(m[1]); return; } // 3️⃣ Fallback for older vanity pages: g_steamID global variable m = html.match(/g_steamID\s*=\s*"(\d{17})"/); if (m) { injectLink(m[1]); } /* ───────── helper ───────── */ function injectLink(id64) { const parent = document.querySelector(".profile_header_actions") || // modern layout button row document.querySelector(".profile_header_summary"); // classic layout fallback if (!parent || document.getElementById("sg-link")) return; // already added const a = document.createElement("a"); a.id = "sg-link"; a.href = `https://www.steamgifts.com/go/user/${id64}`; a.textContent = "SG-link"; a.target = "_blank"; a.rel = "noopener noreferrer"; a.style.cssText = ` display:inline-block; margin-left:8px; padding:4px 8px; background:#8a6dff; color:#fff; border-radius:3px; font-weight:600; text-decoration:none; `; parent.appendChild(a); } })();