diff --git a/Update.json b/Update.json index 0623f008..a8c7b751 100644 --- a/Update.json +++ b/Update.json @@ -3955,6 +3955,17 @@ } ], "Notes": "Add [liushangchen](https://www.xmoj.tech/userinfo.php?user=liushangchen) to AdminUserList" + }, + "4.0.2": { + "UpdateDate": 1791284765643, + "Prerelease": true, + "UpdateContents": [ + { + "PR": 1061, + "Description": "Hide the message button on your own profile" + } + ], + "Notes": "查看自己的个人中心时不再显示“短消息”按钮。" } } } \ No newline at end of file diff --git a/XMOJ.user.js b/XMOJ.user.js index 90a45636..a1bfdc4d 100644 --- a/XMOJ.user.js +++ b/XMOJ.user.js @@ -1,6 +1,6 @@ // ==UserScript== // @name XMOJ -// @version 4.0.1 +// @version 4.0.2 // @description XMOJ增强脚本 // @author @XMOJ-Script-dev, @langningchen and the community // @namespace https://github/langningchen @@ -2666,7 +2666,11 @@ function InitializeUserProfile(isAdmin = false) { // Move the original statistics nodes so their links and handlers survive. table.insertAdjacentElement("beforebegin", profile); - for (let link of table.caption?.querySelectorAll("a") || []) info.appendChild(link); + for (let link of table.caption?.querySelectorAll("a") || []) { + // There is no point in messaging yourself. + if (userID == CurrentUsername && link.getAttribute("href")?.includes("mail.php")) continue; + info.appendChild(link); + } table.caption?.remove(); let solvedCell = [...table.querySelectorAll("td[rowspan]")].find(cell => cell.querySelector('a[href*="problem.php"]') || [...cell.querySelectorAll("script")].some(script => /\bfunction\s+p\s*\(/.test(script.textContent))); diff --git a/package.json b/package.json index 2291755b..2244141e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "xmoj-script", - "version": "4.0.1", + "version": "4.0.2", "description": "an improvement script for xmoj.tech", "main": "AddonScript.js", "scripts": {