Fix some things (thanks besties.house)

This commit is contained in:
MeowcaTheoRange 2024-03-18 20:02:49 -05:00
parent c6918b659b
commit e0f1a59d86
3 changed files with 11 additions and 6 deletions

View file

@ -31,7 +31,6 @@
<input type="text" name="instance" id="instance" class="userinstance" /> <input type="text" name="instance" id="instance" class="userinstance" />
</span> </span>
<br /> <br />
<br />
<hr /> <hr />
<button id="submitwhoami_followers">Play (Followers)</button> <button id="submitwhoami_followers">Play (Followers)</button>
<button id="submitwhoami_following">Play (Following)</button> <button id="submitwhoami_following">Play (Following)</button>

View file

@ -33,6 +33,8 @@ async function verify() {
const instance = el_id_instance.value.replace(/@/gim, ""); const instance = el_id_instance.value.replace(/@/gim, "");
el_id_user.value = username; el_id_user.value = username;
el_id_instance.value = instance; el_id_instance.value = instance;
el_id_submitwhoamiFollowers.disabled = true;
el_id_submitwhoamiFollowing.disabled = true;
if (username.length < 1) return null; if (username.length < 1) return null;
if (instance.length < 1) return null; if (instance.length < 1) return null;
let user_req; let user_req;
@ -42,6 +44,8 @@ async function verify() {
return null; return null;
} }
const user_json = await user_req.json(); const user_json = await user_req.json();
el_id_submitwhoamiFollowers.disabled = false;
el_id_submitwhoamiFollowing.disabled = false;
if (user_req.ok) return { if (user_req.ok) return {
USER_ID: user_json.id, USER_ID: user_json.id,
INSTANCE: instance INSTANCE: instance
@ -115,7 +119,7 @@ async function getFollowers(dontLoadNew = false) {
let out; let out;
if (!dontLoadNew) { if (!dontLoadNew) {
el_id_loadingfollowers.innerHTML = `Retrieving followers... Please wait.`; el_id_loadingfollowers.innerHTML = `Retrieving followers... Please wait.`;
res = await fetch(`https://${game.INSTANCE}/api/v1/accounts/${game.USER_ID}/followers?limit=68${lastId.length > 0 ? `&max_id=${lastId}` : ""}`); res = await fetch(`https://${game.INSTANCE}/api/v1/accounts/${game.USER_ID}/followers${lastId.length > 0 ? `?max_id=${lastId}` : ""}`);
out = await res.json(); out = await res.json();
} }
el_id_submitfollowers.disabled = false; el_id_submitfollowers.disabled = false;
@ -135,11 +139,11 @@ async function getFollowers(dontLoadNew = false) {
${renderNameHTML(cuser.display_name, cuser)} ${renderNameHTML(cuser.display_name, cuser)}
</a> </a>
</td> </td>
<td class="followers_namelabel">@${cuser.fqn}</td> <td class="followers_namelabel">@${cuser.fqn || cuser.acct}</td>
</tr>` </tr>`
}, ""); }, "");
userList.push(...out.map(user => ({ userList.push(...out.map(user => ({
fqn: user.fqn, fqn: user.fqn || user.acct,
avatar: user.avatar, avatar: user.avatar,
bot: user.bot, bot: user.bot,
created_at: user.created_at, created_at: user.created_at,

View file

@ -6,15 +6,17 @@
} }
.userinputbox { .userinputbox {
display: inline-block;
border: var(--border-width) var(--border-style) var(--border-color); border: var(--border-width) var(--border-style) var(--border-color);
border-radius: var(--border-radius); border-radius: var(--border-radius);
padding-inline: 0.25em; padding-inline: 0.25em;
padding-block: 0.25em; padding-block: 0.25em;
white-space: nowrap;
} }
.userinputbox * { /* .userinputbox * {
vertical-align: 0%; vertical-align: 0%;
} } */
#listfollowers, #listfollowing { #listfollowers, #listfollowing {
display: inline-block; display: inline-block;