Repository navigation
Expand file tree
/
Copy pathcode.js
More file actions
79 lines (67 loc) · 2.53 KB
/
Copy pathcode.js
File metadata and controls
79 lines (67 loc) · 2.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
(async function fastDeleteReplies() {
const sleep = (ms) => new Promise((res) => setTimeout(res, ms));
let deletedCount = 0;
console.log("%c[Threads Auto-Delete] Fast Mode Started...", "color: #00ff00; font-weight: bold;");
function getActionButtons() {
const allButtons = Array.from(document.querySelectorAll('div[role="button"], div[tabindex="0"]'));
return allButtons.filter((el) => {
const svg = el.querySelector('svg');
if (!svg) return false;
const circles = svg.querySelectorAll('circle');
if (circles.length === 3) return true;
const title = svg.querySelector('title');
return title && title.textContent.toLowerCase().includes('more');
});
}
while (true) {
const buttons = getActionButtons();
if (buttons.length === 0) {
window.scrollBy(0, 1000);
await sleep(1500);
if (getActionButtons().length === 0) {
window.scrollBy(0, 1500);
await sleep(2000);
if (getActionButtons().length === 0) {
console.log(`%c[Threads Auto-Delete] Done! Total replies deleted: ${deletedCount}`, "color: #00ff00; font-weight: bold;");
break;
}
}
continue;
}
for (const btn of buttons) {
try {
// Fast click 3-dots
btn.click();
await sleep(400);
// Find "Delete" option instantly
const deleteBtn = Array.from(document.querySelectorAll('span, div, button')).find(
(el) => el.children.length === 0 && el.textContent.trim() === 'Delete'
);
if (deleteBtn) {
deleteBtn.click();
await sleep(400);
// Confirm Deletion in popup
const confirmBtn = Array.from(document.querySelectorAll('div[role="dialog"] div[role="button"], div[role="dialog"] button')).find(
(el) => el.textContent.trim().toLowerCase() === 'delete'
);
if (confirmBtn) {
confirmBtn.click();
deletedCount++;
console.log(`%c[Fast Delete] #${deletedCount} removed`, "color: #00ffff;");
// Reduced delay between deletions (1 second)
await sleep(1000);
}
} else {
// Dismiss popup if it wasn't a deletable reply
document.dispatchEvent(new KeyboardEvent('keydown', { key: 'Escape' }));
await sleep(200);
}
} catch (err) {
document.dispatchEvent(new KeyboardEvent('keydown', { key: 'Escape' }));
await sleep(200);
}
}
window.scrollBy(0, 1000);
await sleep(1500);
}
})();