ProfileID on profile

add the profile ID to the profile page, as well as wrapping it in a copyable link

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         ProfileID on profile
// @namespace    http://tampermonkey.net/
// @version      0.3
// @description  add the profile ID to the profile page, as well as wrapping it in a copyable link
// @author       JK_3
// @match        https://www.warzone.com/Profile?p=*
// @match        https://www.warzone.com/profile?p=*
// @match        https://www.warzone.com/Profile?u=*
// @match        https://www.warzone.com/profile?u=*
// @grant        GM_setClipboard
// ==/UserScript==

// changelog

// 0.1:
// added profile ID to page

// 0.2:
// added a few lines to Common Games link since the proper ID was parsed anyways

// 0.2.1
// fixed bug with missing Common Games link element on own profile

// 0.3
// removed patch for Common Games link bug, since Fizzer fixed it on WZ's side

(function() {
    'use strict';

    let profileID = document.body.querySelector("a[href*='Report?p=']").href.slice(33)
    let url = "https://www.warzone.com/Profile?p=" + profileID;

    let centerCol = document.body.querySelector("[class*='order-md-2']")
    let big = centerCol.children[0].children[1]

    let link = document.createElement("a");
    link.href = url;
    link.text = "ID: " + profileID;
    link.id = "ProfileURL";
    link.onclick = () => { GM_setClipboard(url); return false; };

    big.appendChild(document.createElement("br"));
    big.appendChild(link);

})();