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