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"); const about = document.getElementById("about"); const statusus = document.getElementById("status"); const buttonflags = document.getElementById("buttonflags"); const fields = document.getElementById("fields"); const URL_REGEXP = /(([a-z0-9.-]*)(((:\/\/)([a-z0-9.-]*))((\/)([\w;,\/?:@&=+$\-_.!~*'()#]*))?)|(((mailto|tel):)([\w;,\/?:@&=+$\-_.!~*'()#]*)))/g; fetch("https://pronouns.cc/api/v1/users/MeowcaTheoRange") .then((x) => x.json()) .then((user) => { data_whoami.innerHTML = `

I'm ${ user.names[0].value }, also better known online as ${ user.name }. (${user.pronouns .filter((pronoun) => pronoun.status == "okay") .map((pronoun) => pronoun.pronouns.split("/")[0]) .join("/")})

`; about.innerHTML = `

Bio

MeowcaTheoRange
${user.bio .replace(URL_REGEXP, (m) => `${m}`) .replaceAll("\n", "
")}

`; const curTime = new Date(); timezone.innerHTML = `(UTC${user.utc_offset > 0 ? "+" : "-"}${Math.abs( user.utc_offset / (60 * 60) )})`; 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; function updateTime() { curTime.setTime(Date.now()); time.innerHTML = curTime.toLocaleTimeString("en-us", { timeZone: "America/Chicago", }); weekday.innerHTML = curTime.toLocaleString("en-us", { weekday: "long", timeZone: "America/Chicago", }); window.requestAnimationFrame(updateTime); } window.requestAnimationFrame(updateTime); nofetchy.style.display = null; fields.innerHTML = user.fields .map( (fieldset) => `

${fieldset.name}

` ) .join(""); }); fetch("https://local.abtmtr.link/api/v1/accounts/stat/statuses") .then((x) => x.json()) .then((statuses) => { console.log(statuses); statusus.innerHTML = `

Current status

${statuses[0].content}

`; });