DevPlace CI / test (push) Successful in 32m28s
Add `_alt_from_url` helper in Python rendering and `altFromUrl` in JS ContentRenderer to generate descriptive alt attributes from image filenames, replacing empty alt strings. Update image embed templates and Avatar component to use derived alt text. Migrate inline `style.width` assignments to CSS custom properties (`--poll-pct`, `--hud-xp`, `--quest-pct`, `--bar-pct`, `--quota-pct`) across PollManager, GameFarm, and profile/quest CSS for better maintainability. Introduce new admin, docs, projects, services, and base CSS utility classes. Add "Code Farm" docs page entry.
18 lines
516 B
JavaScript
18 lines
516 B
JavaScript
// retoor <retoor@molodetz.nl>
|
|
|
|
export class Avatar {
|
|
static imgElement(username, size = 24) {
|
|
const img = document.createElement("img");
|
|
img.src = `/avatar/multiavatar/${encodeURIComponent(username)}?size=${size}`;
|
|
img.className = "avatar-img";
|
|
img.style.width = `${size}px`;
|
|
img.style.height = `${size}px`;
|
|
img.style.borderRadius = "50%";
|
|
img.alt = `${username} avatar`;
|
|
img.loading = "lazy";
|
|
return img;
|
|
}
|
|
}
|
|
|
|
window.Avatar = Avatar;
|