-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
coreajax.js
113 lines (99 loc) · 5.49 KB
/
coreajax.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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
function getUserInformation(id) {
if (id === null) {
return;
} else {
var xmlhttp = new XMLHttpRequest();
xmlhttp.onreadystatechange = function () {
if (this.readyState === 4 && this.status === 200) {
if (this.responseText === "") {
} else {
var json = JSON.parse(this.responseText);
var blocklistSettings = json.blocklistsettings;
var automationSettings = json.automationsettings;
if (typeof blocklistSettings !== 'undefined' && blocklistSettings !== null) {
blocklistSettings.forEach(checkBlocklistSetting);
}
if (automationSettings.matchingphraseoperation === "Block") {
document.getElementById("block phrases").checked = true;
} else if (automationSettings.matchingphraseoperation === "Mute") {
document.getElementById("mute phrases").checked = true;
} else {
document.getElementById("noaction phrases").checked = true;
}
if (automationSettings.urlsoperation === "Block") {
document.getElementById("block urls").checked = true;
} else if (automationSettings.urlsoperation === "Mute") {
document.getElementById("mute urls").checked = true;
} else {
document.getElementById("noaction urls").checked = true;
}
if (automationSettings.nftprofilepictureoperation === "Block") {
document.getElementById("block nftprofilepictures").checked = true;
} else if (automationSettings.nftprofilepictureoperation === "Mute") {
document.getElementById("mute nftprofilepictures").checked = true;
} else {
document.getElementById("noaction nftprofilepictures").checked = true;
}
if (automationSettings.cryptousernamesoperation === "Block") {
document.getElementById("block cryptousernames").checked = true;
} else if (automationSettings.cryptousernamesoperation === "Mute") {
document.getElementById("mute cryptousernames").checked = true;
} else {
document.getElementById("noaction cryptousernames").checked = true;
}
if (automationSettings.nftfollowersoperation === "Block") {
document.getElementById("block nftfollowers").checked = true;
} else if (automationSettings.nftfollowersoperation === "Mute") {
document.getElementById("mute nftfollowers").checked = true;
} else {
document.getElementById("noaction nftfollowers").checked = true;
}
if (automationSettings.centraldatabaseoperation === "Block") {
document.getElementById("block centraldatabase").checked = true;
} else if (automationSettings.centraldatabaseoperation === "Mute") {
document.getElementById("mute centraldatabase").checked = true;
} else {
document.getElementById("noaction centraldatabase").checked = true;
}
if (automationSettings.cryptospambotsoperation === "Block") {
document.getElementById("block cryptospambots").checked = true;
} else if (automationSettings.cryptospambotsoperation === "Mute") {
document.getElementById("mute cryptospambots").checked = true;
} else {
document.getElementById("noaction cryptospambots").checked = true;
}
if (automationSettings.whitelistfollowings === "N") {
document.getElementById("disable followerwhitelist").checked = true;
} else {
document.getElementById("enable followerwhitelist").checked = true;
}
}
}
};
var params = 'userid='.concat(id);
//Send the proper header information along with the request
xmlhttp.open("POST", "ajaxgetuserinfo.php", true);
xmlhttp.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
xmlhttp.send(params);
}
}
function checkBlocklistSetting(value, index, array) {
var name = value.name;
var lastoperation = value.lastoperation;
if (lastoperation === "Block") {
let fieldName = "block ".concat(name);
document.getElementById(fieldName).checked = true;
} else if (lastoperation === "Mute") {
let fieldName = "mute ".concat(name);
document.getElementById(fieldName).checked = true;
} else if (lastoperation === "Unblock") {
let fieldName = "unblock ".concat(name);
document.getElementById(fieldName).checked = true;
} else if (lastoperation === "Unmute") {
let fieldName = "unmute ".concat(name);
document.getElementById(fieldName).checked = true;
} else if (lastoperation === "Do nothing") {
let fieldName = "noaction ".concat(name);
document.getElementById(fieldName).checked = true;
}
}