您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Shows the player ID next to their name in the profile heading for easy copy/pasting (e.g. turns "Sulsay's profile" into "Sulsay [2173590]").
// ==UserScript== // @name Torn ID in profile title // @namespace https://github.com/sulsay/torn // @version 1.0 // @description Shows the player ID next to their name in the profile heading for easy copy/pasting (e.g. turns "Sulsay's profile" into "Sulsay [2173590]"). // @author Sulsay [2173590] // @match https://www.torn.com/profiles.php* // ==/UserScript== (function() { let originalHeadingTextContent = ''; const heading = Array.from(document.querySelectorAll('h4')).find(h4 => { originalHeadingTextContent = h4.textContent.trim(); return originalHeadingTextContent.endsWith(' Profile') }); if (heading === undefined) { // Profile heading not found or already altered return; } const playerIdMatches = window.location.search.match(/XID=(\d+)/); if (playerIdMatches === null) { // Viewing profile without the XID query param return; } const apostrophePosition = originalHeadingTextContent.indexOf("'"); const playerName = originalHeadingTextContent.substr(0, apostrophePosition); const playerId = parseInt(playerIdMatches[1], 10); heading.textContent = `${playerName} [${playerId}]`; })();