Skip to content

Commit

Permalink
兼容小程序卡片撤回提示 #15
Browse files Browse the repository at this point in the history
  • Loading branch information
xh321 committed Aug 13, 2023
1 parent a868797 commit 92ed6f3
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"name": "防撤回",
"slug": "anti_recall",
"description": "防止QQNT撤回消息",
"version": "0.2.11",
"version": "0.2.12",
"thumbnail": "./icon.png",
"author": {
"name": "XiaoHe321",
Expand Down
18 changes: 15 additions & 3 deletions renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -436,6 +436,10 @@ export async function onLoad() {
`div:not(.gray-tip-message)[id='${msgId}-msgContent']`
);

var arkElement = document.querySelector(
`div:not(.gray-tip-message)[id='ark-msg-content-container_${msgId}']`
);

if (oldElement != null) {
await appendRecalledTag(oldElement);
} else if (newElement != null) {
Expand All @@ -444,6 +448,8 @@ export async function onLoad() {
await appendRecalledTag(unixElement.parentElement);
} else if (cardElement != null) {
await appendRecalledTag(cardElement.parentElement);
} else if (arkElement != null) {
await appendRecalledTag(arkElement.parentElement);
}
});
//消息列表更新回调
Expand Down Expand Up @@ -488,26 +494,32 @@ export async function onLoad() {
var oldElement = document.querySelector(
`div:not(.gray-tip-message)[id='${msgId}-msgContainerMsgContent']`
);

var newElement = document.querySelector(
`.msg-content-container:not(.gray-tip-message)[id='${msgId}-msgContent']`
);

var unixElement = document.querySelector(
`.message:not(.gray-tip-message)[id='ml-${msgId}'] .msg-content-container:not(.gray-tip-message)`
);

var cardElement = document.querySelector(
`div:not(.gray-tip-message)[id='${msgId}-msgContent']`
);

var arkElement = document.querySelector(
`div:not(.gray-tip-message)[id='ark-msg-content-container_${msgId}']`
);

if (oldElement != null) await appendRecalledTag(oldElement);
else if (newElement != null)
await appendRecalledTag(newElement.parentElement);
else if (unixElement != null)
await appendRecalledTag(unixElement.parentElement);
else if (cardElement != null)
await appendRecalledTag(cardElement.parentElement);
else if (arkElement != null)
await appendRecalledTag(arkElement.parentElement);
} catch (e) {
console.log("[Anti-Recall]", "反撤回消息时出错", e);
}
Expand Down

0 comments on commit 92ed6f3

Please # to comment.