Skip to content
This repository has been archived by the owner on Oct 3, 2023. It is now read-only.

Commit

Permalink
Merge pull request #483 from langningchen:langningchen/issue406
Browse files Browse the repository at this point in the history
允许忽略提醒
  • Loading branch information
Chen LangNing authored Sep 23, 2023
2 parents ac9887d + b505dfc commit 8edd6df
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 14 deletions.
10 changes: 10 additions & 0 deletions Update.json
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,16 @@
"Description": "Change layout of ToggleLockButton"
}
]
},
"0.3.165": {
"UpdateDate": 1695443444738,
"Prerelease": true,
"UpdateContents": [
{
"PR": 483,
"Description": "允许忽略提醒"
}
]
}
}
}
3 changes: 3 additions & 0 deletions Update/AutoLabel.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,9 @@ NewData = NewData.replaceAll(/\/[a-zA-Z-]+/g, (match) => {
return match;
});

if (NewData === "") {
NewData = "[]()";
}
console.log("NewData : " + NewData);

if (NewData === Data) {
Expand Down
51 changes: 37 additions & 14 deletions XMOJ.user.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// ==UserScript==
// @name XMOJ
// @version 0.3.164
// @version 0.3.165
// @description XMOJ增强脚本
// @author @langningchen
// @namespace https://github/langningchen
Expand Down Expand Up @@ -718,10 +718,10 @@ else {
ToastContainer.classList.add("toast-container", "position-fixed", "bottom-0", "end-0", "p-3");
document.body.appendChild(ToastContainer);
addEventListener("focus", () => {
ToastContainer.innerHTML = "";
if (UtilityEnabled("BBSPopup")) {
RequestAPI("GetBBSMentionList", {}, (Response) => {
if (Response.Success) {
ToastContainer.innerHTML = "";
let MentionList = Response.Data.MentionList;
for (let i = 0; i < MentionList.length; i++) {
let Toast = document.createElement("div");
Expand All @@ -748,17 +748,27 @@ else {
ToastBody.innerHTML = "讨论" + MentionList[i].PostTitle + "有新回复";
let ToastFooter = document.createElement("div");
ToastFooter.classList.add("mt-2", "pt-2", "border-top");
let ToastButton = document.createElement("button");
ToastButton.type = "button";
ToastButton.classList.add("btn", "btn-primary", "btn-sm");
ToastButton.innerText = "查看";
ToastButton.addEventListener("click", () => {
let ToastDismissButton = document.createElement("button");
ToastDismissButton.type = "button";
ToastDismissButton.classList.add("btn", "btn-secondary", "btn-sm", "me-2");
ToastDismissButton.innerText = "忽略";
ToastDismissButton.addEventListener("click", () => {
RequestAPI("ReadBBSMention", {
"MentionID": Number(MentionList[i].MentionID)
}, () => { });
});
ToastFooter.appendChild(ToastDismissButton);
let ToastViewButton = document.createElement("button");
ToastViewButton.type = "button";
ToastViewButton.classList.add("btn", "btn-primary", "btn-sm");
ToastViewButton.innerText = "查看";
ToastViewButton.addEventListener("click", () => {
open("http://www.xmoj.tech/discuss3/thread.php?tid=" + MentionList[i].PostID, "_blank");
RequestAPI("ReadBBSMention", {
"MentionID": Number(MentionList[i].MentionID)
}, () => { });
});
ToastFooter.appendChild(ToastButton);
ToastFooter.appendChild(ToastViewButton);
ToastBody.appendChild(ToastFooter);
Toast.appendChild(ToastBody);
ToastContainer.appendChild(Toast);
Expand All @@ -770,6 +780,9 @@ else {
if (UtilityEnabled("MessagePopup")) {
RequestAPI("GetMailMentionList", {}, async (Response) => {
if (Response.Success) {
if (!UtilityEnabled("BBSPopup")) {
ToastContainer.innerHTML = "";
}
let MentionList = Response.Data.MentionList;
for (let i = 0; i < MentionList.length; i++) {
let Toast = document.createElement("div");
Expand Down Expand Up @@ -799,17 +812,27 @@ else {
ToastBody.innerHTML += " 给你发了一封短消息";
let ToastFooter = document.createElement("div");
ToastFooter.classList.add("mt-2", "pt-2", "border-top");
let ToastButton = document.createElement("button");
ToastButton.type = "button";
ToastButton.classList.add("btn", "btn-primary", "btn-sm");
ToastButton.innerText = "查看";
ToastButton.addEventListener("click", () => {
let ToastDismissButton = document.createElement("button");
ToastDismissButton.type = "button";
ToastDismissButton.classList.add("btn", "btn-secondary", "btn-sm", "me-2");
ToastDismissButton.innerText = "忽略";
ToastDismissButton.addEventListener("click", () => {
RequestAPI("ReadMailMention", {
"MentionID": Number(MentionList[i].MentionID)
}, () => { });
});
ToastFooter.appendChild(ToastDismissButton);
let ToastViewButton = document.createElement("button");
ToastViewButton.type = "button";
ToastViewButton.classList.add("btn", "btn-primary", "btn-sm");
ToastViewButton.innerText = "查看";
ToastViewButton.addEventListener("click", () => {
open("http://www.xmoj.tech/mail.php?other=" + MentionList[i].FromUserID, "_blank");
RequestAPI("ReadMailMention", {
"MentionID": Number(MentionList[i].MentionID)
}, () => { });
});
ToastFooter.appendChild(ToastButton);
ToastFooter.appendChild(ToastViewButton);
ToastBody.appendChild(ToastFooter);
Toast.appendChild(ToastBody);
ToastContainer.appendChild(Toast);
Expand Down

0 comments on commit 8edd6df

Please sign in to comment.