Skip to content

Commit be8b71a

Browse files
committed
支持反撤回自己发送的消息 #19
1 parent 5086aff commit be8b71a

File tree

3 files changed

+39
-6
lines changed

3 files changed

+39
-6
lines changed

main.js

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ var sampleConfig = {
1313
mainColor: "#ff6d6d",
1414
saveDb: false,
1515
enableShadow: true,
16-
enableTip: true
16+
enableTip: true,
17+
isAntiRecallSelfMsg: false
1718
};
1819

1920
var nowConfig = {};
@@ -335,8 +336,9 @@ function onBrowserWindowCreated(window) {
335336
null &&
336337
item.elements[0].grayTipElement
337338
.revokeElement != null &&
338-
!item.elements[0].grayTipElement
339-
.revokeElement.isSelfOperate
339+
(nowConfig.isAntiRecallSelfMsg ||
340+
!item.elements[0].grayTipElement
341+
.revokeElement.isSelfOperate)
340342
) {
341343
needUpdateIdx.push(idx);
342344
}
@@ -478,8 +480,9 @@ function onBrowserWindowCreated(window) {
478480
null &&
479481
msgList.elements[0].grayTipElement
480482
.revokeElement != null &&
481-
!msgList.elements[0].grayTipElement
482-
.revokeElement.isSelfOperate
483+
(nowConfig.isAntiRecallSelfMsg ||
484+
!msgList.elements[0].grayTipElement
485+
.revokeElement.isSelfOperate)
483486
) {
484487
window.webContents.send(
485488
"LiteLoader.anti_recall.mainWindow.recallTip",

manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"name": "防撤回",
55
"slug": "anti_recall",
66
"description": "防止QQNT撤回消息",
7-
"version": "0.2.13",
7+
"version": "0.2.14",
88
"thumbnail": "./icon.png",
99
"author": {
1010
"name": "XiaoHe321",

renderer.js

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,18 @@ export async function onConfigView(view) {
2828
</div>
2929
</div>
3030
31+
<hr class="horizontal-dividing-line" />
32+
<div class="vertical-list-item">
33+
<div style="width:90%;" >
34+
<h2>是否反撤回自己的消息</h2>
35+
<span class="secondary-text">如果开启,则自己发送的消息也会被反撤回。开启后,从下一条消息开始起生效。</span>
36+
</div>
37+
<div id="switchAntiRecallSelf" class="q-switch">
38+
<span class="q-switch__handle"></span>
39+
</div>
40+
</div>
41+
42+
3143
</div>
3244
3345
</div>
@@ -325,6 +337,24 @@ export async function onConfigView(view) {
325337
await window.anti_recall.saveConfig(nowConfig);
326338
});
327339

340+
//反撤回自己消息开关
341+
var q_switch_antiself = node2.querySelector("#switchAntiRecallSelf");
342+
343+
if (nowConfig.isAntiRecallSelfMsg == true) {
344+
q_switch_antiself.classList.toggle("is-active");
345+
}
346+
347+
q_switch_antiself.addEventListener("click", async () => {
348+
if (q_switch_antiself.classList.contains("is-active")) {
349+
nowConfig.isAntiRecallSelfMsg = false;
350+
} else {
351+
nowConfig.isAntiRecallSelfMsg = true;
352+
}
353+
q_switch_antiself.classList.toggle("is-active");
354+
await window.anti_recall.saveConfig(nowConfig);
355+
});
356+
357+
328358
//阴影开关
329359
var q_switch_shadow = node2.querySelector("#switchShadow");
330360

0 commit comments

Comments
 (0)