2023-11-26 06:39:30 +00:00
|
|
|
const data_whoami = document.getElementById("data_whoami");
|
|
|
|
const time = document.getElementById("time");
|
|
|
|
const weekday = document.getElementById("weekday");
|
|
|
|
const timezone = document.getElementById("timezone");
|
|
|
|
const nofetchy = document.getElementById("no-fetchy");
|
2023-12-29 07:18:20 +00:00
|
|
|
const about = document.getElementById("about");
|
|
|
|
const statusus = document.getElementById("status");
|
2023-12-01 02:55:43 +00:00
|
|
|
const buttonflags = document.getElementById("buttonflags");
|
2023-11-26 20:25:54 +00:00
|
|
|
const fields = document.getElementById("fields");
|
2023-12-29 07:18:20 +00:00
|
|
|
|
|
|
|
const URL_REGEXP =
|
|
|
|
/(([a-z0-9.-]*)(((:\/\/)([a-z0-9.-]*))((\/)([\w;,\/?:@&=+$\-_.!~*'()#]*))?)|(((mailto|tel):)([\w;,\/?:@&=+$\-_.!~*'()#]*)))/g;
|
2023-11-26 06:39:30 +00:00
|
|
|
fetch("https://pronouns.cc/api/v1/users/MeowcaTheoRange")
|
|
|
|
.then((x) => x.json())
|
|
|
|
.then((user) => {
|
|
|
|
data_whoami.innerHTML = `
|
|
|
|
<p>I'm <a href="https://pronouns.cc/@MeowcaTheoRange" target="_blank"><b>${
|
|
|
|
user.names[0].value
|
|
|
|
}</b></a>, also better known online as <b>${
|
|
|
|
user.name
|
2023-12-29 07:18:20 +00:00
|
|
|
}</b>. <small>(${user.pronouns
|
|
|
|
.filter((pronoun) => pronoun.status == "okay")
|
2023-11-26 06:39:30 +00:00
|
|
|
.map((pronoun) => pronoun.pronouns.split("/")[0])
|
|
|
|
.join("/")})</small></p>`;
|
2023-12-29 07:18:20 +00:00
|
|
|
about.innerHTML = `<h2>Bio</h2><p>MeowcaTheoRange<br />${user.bio
|
|
|
|
.replace(URL_REGEXP, (m) => `<a href="${m}" target="_blank">${m}</a>`)
|
|
|
|
.replaceAll("\n", "<br />")}</p>`;
|
2023-11-26 06:39:30 +00:00
|
|
|
const curTime = new Date();
|
|
|
|
timezone.innerHTML = `(UTC${user.utc_offset > 0 ? "+" : "-"}${Math.abs(
|
|
|
|
user.utc_offset / (60 * 60)
|
|
|
|
)})`;
|
2023-12-01 02:55:43 +00:00
|
|
|
buttonflags.onclick = () => {
|
|
|
|
user.flags.forEach((flag) => {
|
|
|
|
const props = flag.description.split(";");
|
|
|
|
initDocument(
|
|
|
|
props[0].split(","),
|
|
|
|
props[1],
|
|
|
|
props[2],
|
|
|
|
props[3],
|
|
|
|
flag.name
|
|
|
|
);
|
|
|
|
});
|
|
|
|
};
|
|
|
|
buttonflags.disabled = false;
|
2023-11-26 06:39:30 +00:00
|
|
|
function updateTime() {
|
2023-12-29 07:18:20 +00:00
|
|
|
curTime.setTime(Date.now());
|
|
|
|
time.innerHTML = curTime.toLocaleTimeString("en-us", {
|
|
|
|
timeZone: "America/Chicago",
|
|
|
|
});
|
|
|
|
weekday.innerHTML = curTime.toLocaleString("en-us", {
|
|
|
|
weekday: "long",
|
|
|
|
timeZone: "America/Chicago",
|
|
|
|
});
|
2023-11-26 06:39:30 +00:00
|
|
|
|
|
|
|
window.requestAnimationFrame(updateTime);
|
|
|
|
}
|
|
|
|
window.requestAnimationFrame(updateTime);
|
|
|
|
nofetchy.style.display = null;
|
2023-11-26 20:25:54 +00:00
|
|
|
fields.innerHTML = user.fields
|
|
|
|
.map(
|
|
|
|
(fieldset) => `
|
|
|
|
<section>
|
|
|
|
<h2>${fieldset.name}</h2>
|
|
|
|
<ul>${fieldset.entries
|
|
|
|
.map((entry) => `<li>${entry.value}</li>`)
|
|
|
|
.join("")}</ul>
|
|
|
|
</section>`
|
|
|
|
)
|
|
|
|
.join("");
|
2023-11-26 06:39:30 +00:00
|
|
|
});
|
2023-12-29 07:18:20 +00:00
|
|
|
|
|
|
|
fetch("https://local.abtmtr.link/api/v1/accounts/stat/statuses")
|
|
|
|
.then((x) => x.json())
|
|
|
|
.then((statuses) => {
|
|
|
|
console.log(statuses);
|
|
|
|
statusus.innerHTML = `<h2><a href="${statuses[0].url}" target="_blank">Current status</a></h2>${statuses[0].content}<p></p>`;
|
|
|
|
});
|