Skip to content
This repository was archived by the owner on Dec 15, 2023. It is now read-only.

Commit 22e9696

Browse files
committed
fixed rap not going other pages & poof extra logo
1 parent a5ec7d0 commit 22e9696

File tree

1 file changed

+20
-6
lines changed

1 file changed

+20
-6
lines changed

userscript/src/index.js

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,20 @@ async function getRank(groupId, playerId) {
2424
async function getCollectibles(playerId) {
2525
// https://www.syntax.eco/public-api/v1/inventory/collectibles/id
2626
const url = `https://www.syntax.eco/public-api/v1/inventory/collectibles/${playerId}`;
27-
const response = await fetch(url);
28-
const json = await response.json();
27+
var response = await fetch(url);
28+
var json = await response.json();
2929
// check for "assets" in the json
30+
var biglist = []
3031
if ("data" in json) {
32+
if (json.next_page != null) {
33+
while (json.next_page != null) {
34+
var urlnext = url + "?page=" + json.next_page;
35+
var response = await fetch(urlnext);
36+
var json = await response.json();
37+
biglist = biglist.concat(json["data"]);
38+
}
39+
return biglist;
40+
}
3141
return json["data"]
3242
} else {
3343
return [];
@@ -81,16 +91,20 @@ async function main() {
8191
const rank = await getRank(23, userid);
8292
const isAdmin = await getRank(15, userid);
8393
if (Number(isAdmin) > 0) {
94+
// get /html/body/div[2]/div/div[1]/div[1]/div[2]/div[1]/span
95+
var bclogo = document.evaluate("/html/body/div[2]/div/div[1]/div[1]/div[2]/div[1]/span", document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;
96+
bclogo.remove();
97+
8498
const logo = document.createElement("img");
8599
logo.src = "https://cdn.syntax.eco/75f2f7aa21c88470b2fd325523e0dbe36203a52758a29fef328f5613cac9b4ba1e8f85fbfdcf1c982c2ba1a4f09b9877a7558dc2618d092a494cb4246258cd3d";
86-
logo.style = "height: 40px; width: 40px;";
100+
logo.style = "height: 30px; width: 30px; margin-left: 5px; margin-bottom: 5px;";
87101
nameholder.insertBefore(logo, userelement.nextSibling);
88-
}
102+
} else
89103
if (Number(rank) > 0) {
90104
const nameholder = userelement.parentElement;
91105
const logo = document.createElement("img");
92106
logo.src = logoSrc;
93-
logo.style = "height: 40px; width: 40px;";
107+
logo.style = "height: 30px; width: 30px;";
94108
nameholder.insertBefore(logo, userelement.nextSibling);
95109
}
96110
// User Recent Average Price sum of collectibles
@@ -106,7 +120,7 @@ async function main() {
106120
holder.className = "me-3"
107121
const title = document.createElement("p");
108122
title.className = "m-0 text-secondary w-100 text-center d-block";
109-
title.innerText = "User RAP";
123+
title.innerText = "RAP";
110124
title.style = "font-size: 15px;";
111125
const rapElement = document.createElement("p");
112126
rapElement.className = "m-0 text-decoration-none text-white w-100 text-center d-block";

0 commit comments

Comments
 (0)