WZ Common Mail Search button

Creates a button on player profiles to quickly find common mails between yourself and the player

目前为 2023-04-27 提交的版本。查看 最新版本

// ==UserScript==
// @name         WZ Common Mail Search button
// @namespace    http://tampermonkey.net/
// @version      0.2
// @description  Creates a button on player profiles to quickly find common mails between yourself and the player
// @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=*

// ==/UserScript==

(function() {
    'use strict';

    let ownAccountID = document.getElementById("AccountDropDown").nextElementSibling.firstElementChild.href.match(/p=(\d*)/gmi)[0].slice(4,-2)
    let accountID = document.location.href.match(/p=(\d*)/gmi)[0].slice(4,-2);

    if (accountID != ownAccountID ) { //dont create button on own account page

        let target = "https://www.warzone.com/Discussion/SearchPrivateDiscussions?PlayerID=" + accountID;

        let link = document.createElement("a");
        link.href = target;
        link.text = "Common mails";
        link.style.color = "#000000";

        let btn = document.createElement("button");
        btn.appendChild(link);
        btn.id = "commonMailSearchBtn";
        btn.style.cursor = "pointer";
        btn.onclick = target;

        let buttonDiv = document.createElement("div");
        buttonDiv.id = "commonMailSearch";
        buttonDiv.appendChild(document.createElement("br"));
        buttonDiv.appendChild(btn)

        let feedbackMsgElement = document.getElementById("FeedbackMsg");
        feedbackMsgElement.insertAdjacentElement('beforeBegin', buttonDiv)
    }
})();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址