-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
183 lines (151 loc) · 5.18 KB
/
index.html
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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="index.css">
<link rel="shortcut icon" href="logo.png" type="image/x-icon">
<meta content="GR-POINTS" property="og:title" />
<meta content="#ffffff" data-react-helmet="true" name="theme-color" />
<meta property="og:description"
content="View the floor of GR2.0 with their points and search for specific robots to find their total points." />
<meta property="og:type" content="website" />
<meta property="og:image" content="https://i.imgur.com/GhVHP0g.png" />
<meta property="og:url" content="https://gr-points.vercel.app" />
<meta property="og:site_name" content="GR POINTS" />
<meta name="twitter:card" content="summary_large_image" />
<meta name="twitter:site" content="@GenerousRobots" />
<meta name="twitter:title" content="GenerousRobots" />
<meta name="twitter:description"
content="View the floor of GR2.0 with their points and search for specific robots to find their total points." />
<meta name="twitter:image" content="https://i.imgur.com/GhVHP0g.png" />
<script src="https://kit.fontawesome.com/66aa7c98b3.js" crossorigin="anonymous"></script>
<title> Generous Robots Points </title>
</head>
<body>
<div class="loading" id="loading">
<img src="https://storage.googleapis.com/unrevealed-gr/0.gif">
</div>
<div class="header">
<div class="logo"></div>
</div>
<section class="main">
<div class="top">
<h1> Current Listings </h1>
<table id="table">
<thead>
<tr>
<th>Robot</th>
<th>Price</th>
<th>Points</th>
</tr>
</thead>
<tbody id="tbody">
</tbody>
</table>
</div>
<div class="bottom">
<h1> Search for a Specific Robot</h1>
<div class="search"><input placeholder="Enter the mint address." id="search-input"><button
onclick="search()">Search</button></div>
<table id="search-table">
<thead>
<tr>
<th>Robot</th>
<th>Points</th>
</tr>
</thead>
<tbody id="search-tbody">
</tbody>
</table>
</div>
<div class="box"></div>
</section>
<div class="footer">
<a href="https://twitter.com/stjpg_" target="_blank">Made by stjkr.</a>
</div>
</body>
</html>
<script>
var load = function (start) {
var xhttp = new XMLHttpRequest();
xhttp.open("GET", "https://api-gr.stjkr.repl.co/listings/start=" + start, true);
xhttp.setRequestHeader("Content-Type", "application/json");
xhttp.setRequestHeader('Access-Control-Allow-Headers', '*');
xhttp.setRequestHeader('Access-Control-Allow-Origin', '*');
xhttp.onreadystatechange = function () {
if (this.readyState == 4 && this.status == 200) {
const response = JSON.parse(xhttp.responseText);
response.sort((a, b) => a.price - b.price);
for (let i = 0; i < response.length; i++) {
var tr = document.createElement("tr");
var td1 = document.createElement("td");
var a1 = document.createElement("a");
a1.href = "https://magiceden.io/item-details/" + response[i]["tkn"];
a1.target = "_blank";
a1.innerText = response[i]["tkn"].substr(0, 3) + "..." + response[i]["tkn"].substr(41, 44);
td1.appendChild(a1);
var td2 = document.createElement("td");
td2.innerText = "◎" + response[i]["price"]
var td3 = document.createElement("td");
td3.innerText = response[i]["points"]
if (response[i]["points"] != "Unknown.") {
var point = document.createElement("img");
point.src = "point.png";
td3.appendChild(point);
}
tr.appendChild(td1);
tr.appendChild(td2);
tr.appendChild(td3);
document.getElementById("tbody").appendChild(tr);
}
try {
document.getElementById("loading").style.display = "none";
} catch { }
}
console.log(this.responseText);
};
xhttp.send();
}
var search = function () {
var xhttp = new XMLHttpRequest()
tkn = document.getElementById("search-input").value;
xhttp.open("GET", "https://api-gr.stjkr.repl.co/token/tkn=" + tkn, true);
xhttp.setRequestHeader("Content-Type", "application/json");
xhttp.setRequestHeader('Access-Control-Allow-Headers', '*');
xhttp.setRequestHeader('Access-Control-Allow-Origin', '*');
xhttp.onreadystatechange = function () {
if (this.readyState == 4 && this.status == 200) {
response = this.responseText;
var tr = document.createElement("tr");
var td1 = document.createElement("td");
var a1 = document.createElement("a");
a1.href = "https://magiceden.io/item-details/" + tkn;
a1.target = "_blank";
a1.innerText = tkn.substr(0, 3) + "..." + tkn.substr(41, 44);
td1.appendChild(a1);
var td3 = document.createElement("td");
td3.innerText = response;
if (response != "Unknown.") {
var point = document.createElement("img");
point.src = "point.png";
td3.appendChild(point);
}
tr.appendChild(td1);
tr.appendChild(td3);
document.getElementById("search-tbody").appendChild(tr);
}
try {
document.getElementById("loading").style.display = "none";
} catch { }
console.log(this.responseText);
};
if (tkn != "") {
xhttp.send();
}
}
window.onload = function () {
load(0)
}
</script>