-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.js
42 lines (35 loc) · 1.33 KB
/
main.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
var pleaseUnfriendAllPlease = function () {
var done = [];
var clickElement = function(elem) {
elem.style.border = "thick solid red";
elem.click();
}
var unfriendFriend = function(idx) {
// unfriend
[...document.querySelectorAll('a[role="menuitem"][ajaxify*="removefriendconfirm"]')].forEach( (a) => {
if (done.includes(a.attributes["ajaxify"].value) === false) {
done.push(a.attributes["ajaxify"].value);
clickElement(a);
console.log('unfriended...');
}
});
setTimeout(unfriend, 2000);
}
var unfriend = function() {
// button
var elem = [...document.querySelectorAll('ul[class~="uiList"] a[role="button"][class~="friendButton"]')][0];
if (elem) {
if (done.includes(elem.attributes["data-profileid"].value) === false) {
done.push(elem.attributes["data-profileid"].value);
clickElement(elem);
} else {
elem.parentNode.removeChild(elem);
}
setTimeout(unfriendFriend, 500);
} else {
clearTimeout();
console.log('DONE. Now enroll for a potter workshop and make friends there.');
}
};
unfriend();
}