-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathremove.js
46 lines (38 loc) · 1.8 KB
/
remove.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
// Go to https://m.facebook.com/friends/center/friends
// Open the console and type "allow pasting" enter, and paste the code enter.
function getRandomArbitrary(min, max) { return Math.random() * (max - min) + min; }
function stop() { clearInterval(interval); }
function start() { removeFriend().next(); }
function startInterval() {
// Set interval to a large value to avoid suspicion from Facebook
interval = setInterval(start, getRandomArbitrary(2000, 5500));
return interval;
}
async function clickElement(element, entry) {
if (entry == null || entry == "0") {
await element.click();
return await element.click();
}
}
let intervalId = startInterval();
function* removeFriend() {
while (true) {
nextClick = nextRecord.lastElementChild.firstChild.firstChild.lastChild.firstChild;
nextRecordCopy = nextRecord;
nextRecord = nextRecord.nextSibling;
if (nextRecord == null) {
nextRecord = nextRecordCopy;
nextRecord = nextRecord?.parentElement?.nextElementSibling?.firstElementChild;
if (nextRecord == undefined) {
stop(intervalId);
}
}
clickElement(nextClick);
remover = nextClick.nextElementSibling.firstElementChild.firstElementChild.firstElementChild.nextElementSibling.firstElementChild.nextElementSibling;
clickElement(remover, 0);
yield;
}
}
currentPage = this.document;
firstRecord = currentPage.firstChild.nextSibling.firstChild.nextElementSibling.firstChild.nextElementSibling.firstChild.nextElementSibling.firstChild.nextElementSibling.nextElementSibling.nextElementSibling.firstElementChild.firstElementChild.firstElementChild.nextElementSibling.firstElementChild;
nextRecord = firstRecord;