-
Notifications
You must be signed in to change notification settings - Fork 10
/
pleaseRemoveMePlease.js
76 lines (54 loc) · 3.13 KB
/
pleaseRemoveMePlease.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
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
// 1. Go to: https://www.facebook.com/lorepirri/allactivity
// 2. Select an entry from the left menu
// 3. Scroll down to have a reasonable number of items to delete (~500 is good)
// 4. Paste the script into the console prompt (F12 to open the Developer tools)
// 5. Type pleaseRemoveMePlease() and hit return
var actions = ["report.php?content_type","delete/confirm","action=remove_video_watch","action=unsubscribe_calendar","action=unlike","action=hide","action=remove_comment","action=unfan_fbpage","action=delete_save"];
var actionsToBeConfirmed = ["delete/confirm"];
var actionsToBeConfirmedWithRadiobox = ["report.php?content_type"];
var isToBe = function (value, allowed) { return allowed.some( (a) => { return value.indexOf(a) !== -1; } ); };
var isToBeRemoved = function (value) { return isToBe(value, actions); };
var isToBeConfirmed = function (value) { return isToBe(value, actionsToBeConfirmed); };
var isToBeConfirmedWithRadiobox = function (value) { return isToBe(value, actionsToBeConfirmedWithRadiobox); };
var pleaseRemoveMePlease = function () {
var doActions = [];
var confirmRemoveTagDone = function(idx) {
[...document.querySelectorAll('a[id="nfx_dialog_done"]')].forEach( (a) => { a.style.border = "thick solid red"; a.click(); });
setTimeout(removeMe, 7000, idx);
}
var confirmRemoveTag = function(idx) {
[...document.querySelectorAll('a[id="NFXAction-UNTAG"]')].forEach( (a) => { a.style.border = "thick solid red"; a.click(); });
setTimeout(confirmRemoveTagDone, 7000, idx);
}
var removeTagDone = function(idx) {
[...document.querySelectorAll('button[class~="layerConfirm"]')].forEach( (a) => { a.style.border = "thick solid red"; a.click(); });
setTimeout(confirmRemoveTag, 7000, idx);
}
var removeTag = function(idx) {
[...document.querySelectorAll('input[value="annoying"]')].forEach( (a) => { a.style.border = "thick solid red"; a.click(); });
setTimeout(removeTagDone, 4000, idx);
}
var deleteMe = function(idx) {
[...document.querySelectorAll('button[class~="layerConfirm"]')].forEach( (a) => { a.style.border = "thick solid red"; a.click(); });
setTimeout(removeMe, 7000, idx);
}
var removeMe = function(idx) {
if (idx < doActions.length) {
doActions[idx].click();
console.log('task:', idx+1, 'of', doActions.length);
if (isToBeConfirmed(doActions[idx].attributes["ajaxify"].value)) {
setTimeout(deleteMe, 2000, idx+1);
} else if (isToBeConfirmedWithRadiobox(doActions[idx].attributes["ajaxify"].value)) {
setTimeout(removeTag, 2000, idx+1);
} else {
setTimeout(removeMe, 500, idx+1);
}
} else {
clearTimeout();
console.log('DONE. You did a favor to your past and present self. Go now play in the offline world, please.');
}
};
var idx=0;
[...document.querySelectorAll('a[rel="async-post"]')].forEach( (a) => { if (isToBeRemoved(a.attributes["ajaxify"].value) ) { doActions[idx++] = a; }});
removeMe(0);
}