-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
34 lines (32 loc) · 1.04 KB
/
index.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
function readTextFile(file, callback) {
let rawFile = new XMLHttpRequest();
rawFile.overrideMimeType("application/json");
rawFile.open("GET", file, true);
rawFile.onreadystatechange = function () {
if (rawFile.readyState === 4 && rawFile.status == "200") {
callback(rawFile.responseText);
}
};
rawFile.send(null);
}
const getFileData = () => {
return new Promise((resolve, reject) => {
readTextFile("./TokenFarmers.json", function (text) {
var data = JSON.parse(text);
resolve(data);
});
});
};
(function main() {
getFileData().then((data) => {
const input = document.getElementById("search_field");
const btn = document.getElementById("search_btn");
btn.onclick = function () {
if (!data[input.value]) {
alert("Your account/input is not present in the farmers list.");
} else {
alert("Your account/input is tagged as a farmer/bot account");
}
};
});
})();