function addToOutput(starting, json, key, title) {
starting += `
${title}
`;
for (let i = 0; i < json[key].length; i++) {
starting += `
${icons[json[key][i][1]]} ${escapeHTML(json[key][i][0])}
`;
}
starting += "
";
return starting;
}
let x2 = window.location.href.split("?")[0].split("/");
fetch("/api/account/info/" + x2[x2.length - 1].toLowerCase(), {
"method": "GET"
}).then((response) => (response.json()))
.then((json) => {
document.body.setAttribute("style", `--background: ${json.colors.background}; --background-low-opacity: ${json.colors.background}33; --accent: ${json.colors.accent}; --accent-low-opacity: ${json.colors.accent}66; --text: ${json.colors.text}; --text-low-opacity: ${json.colors.text}88;`);
let x = document.createElement("div");
let inner = `
${escapeHTML(json.display_name)}
${escapeHTML(json.description)}
`;
document.title = `${json.display_name} (@${x2[x2.length - 1]})`;
inner = addToOutput(inner, json, "names", "Names");
inner = addToOutput(inner, json, "pronouns", "Pronouns");
inner = addToOutput(inner, json, "honorifics", "Honorifics");
inner = addToOutput(inner, json, "compliments", "Compliments");
inner = addToOutput(inner, json, "relationship", "Relationship
Descriptions");
inner += "
";
x.id = "container";
x.innerHTML = inner;
document.body.append(x);
})
.catch((err) => {
document.body.innerHTML = "User not found!
Sign up - Log in";
});