-
Notifications
You must be signed in to change notification settings - Fork 10
/
pleaseRemoveDiscussionPlease.js
46 lines (38 loc) · 1.5 KB
/
pleaseRemoveDiscussionPlease.js
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
// Messenger: remove all the messages
// 1. Go to https://www.messenger.com
// 2. Scroll down in the left column until the last chat
// 2. Paste the script into the console prompt (F12 to open the Developer tools)
// 3. Type pleaseRemoveDiscussionPlease() and hit return
var pleaseRemoveDiscussionPlease = function () {
var clickElement = function(elem) {
elem.style.border = "thick solid red";
elem.click();
}
var confirmDeleteDiscussion = function(idx) {
[...document.querySelectorAll('div[role="dialog"] button')].forEach( (a) => {
if (a.innerHTML === "Delete") {
clickElement(a);
}
});
setTimeout(removeDiscussion, 5000, idx);
}
var deleteDiscussion = function(idx) {
[...document.querySelectorAll('li[role="presentation"] > a[role="menuitem"] > span > span')].forEach( (a) => {
if (a.innerHTML === "Delete") {
clickElement(a);
}
});
setTimeout(confirmDeleteDiscussion, 2000, idx);
}
var removeDiscussion = function() {
var elem = [...document.querySelectorAll('div[aria-label="Actions"] > div > div[aria-label="Conversation actions"]')][0];
if (elem) {
clickElement(elem);
setTimeout(deleteDiscussion, 600);
} else {
clearTimeout();
console.log('DONE. Now drop a message to somebody on Signal and have a walk together.');
}
};
removeDiscussion();
}