diff options
author | WlodekM <[email protected]> | 2024-12-01 12:52:29 +0200 |
---|---|---|
committer | WlodekM <[email protected]> | 2024-12-01 12:52:29 +0200 |
commit | f84e913cfc6773fea1f79c6d99ff6253715770dc (patch) | |
tree | 8a3200f603887576ff115ba84a2cde953127ff25 /pages | |
parent | a0f9849990fafd3c71160e17593719acd5a13d76 (diff) |
dont wait for attachments to load, default pfp
Diffstat (limited to 'pages')
-rw-r--r-- | pages/main/page.js | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/pages/main/page.js b/pages/main/page.js index 447e5cf..f1d40f2 100644 --- a/pages/main/page.js +++ b/pages/main/page.js @@ -73,18 +73,19 @@ export async function onload() { } async function createMessage(msg) { + const elem = html('div') + msgArea.appendChild(elem) let types = []; for (const attachment of msg.attachments) { console.debug(attachment) const resp = await fetch(attachment.toString()); types.push(resp.headers.get('content-type')) } - let elem = html('div') - .class('message') + elem.class('message') .child('div') .class('message-container') .child('img') - .attr('src', msg.author.avatar) + .attr('src', msg.author.avatar || '/assets/pfp_sdwl.png') .class('avatar') .ev('click', e => openPopup(buildUserPopup(msg.author))) .up() @@ -137,15 +138,17 @@ export async function onload() { .up() .up() .up() - msgArea.appendChild(elem) } document.getElementById("messageForm").classList.remove('disabled') msgArea.innerHTML = ""; // :+1: + msgArea.style.display = 'none' + for (const msg of window.stores.sdlib.messages.reverse()) { - await createMessage(msg) + createMessage(msg) } + msgArea.style.display = 'block' scrollToBottomOfElement(msgArea.parentElement); stores.sdlib.wsEvents.on("new_post", handleNewPost) |