From 086c11d3cce85c2532192c78c97d1db2dedbbcbe Mon Sep 17 00:00:00 2001 From: "[it/its]@Rory&" <[it/its]@Rory&> Date: Thu, 1 Jan 2026 15:43:44 +0100 Subject: [PATCH] option to show avatars on join eevents --- src/webpage/message.ts | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/src/webpage/message.ts b/src/webpage/message.ts index aead5de..c225bf9 100644 --- a/src/webpage/message.ts +++ b/src/webpage/message.ts @@ -16,6 +16,7 @@ import {Hover} from "./hover.js"; import {Dialog} from "./settings.js"; import {Sticker} from "./sticker.js"; import {Components} from "./interactions/compontents.js"; +import {ImagesDisplay} from "./disimg"; class Message extends SnowFlake { static contextmenu = new Contextmenu("message menu"); stickers!: Sticker[]; @@ -940,6 +941,42 @@ class Message extends SnowFlake { firstspan.textContent = first; text.appendChild(firstspan); + // TODO: settings how? + if (true) { + const img = document.createElement("img"); + img.classList.add("avatar"); + img.style.height = "1em"; + img.style.width = "1em"; + img.style.objectFit = "cover"; + img.src = this.author.getpfpsrc(this.guild) + "?size=1"; + img.loading = "lazy"; + img.decoding = "async"; + img.addEventListener( + "load", + () => { + img.src = this.author.getpfpsrc(this.guild) + "?size=" + firstspan.clientHeight; + }, + {once: true}, + ); + img.onclick = () => { + const full = new ImagesDisplay([ + new File( + { + content_type: "image/webp", + filename: "0", + id: "0", + size: 0, + url: this.author.getpfpsrc(this.guild), + }, + this, + ), + ]); + full.show(); + }; + + text.appendChild(img); + } + const username = document.createElement("span"); username.textContent = this.author.name; //this.author.profileclick(username);