mirror of
https://github.com/nfonteyne/octane-website.git
synced 2026-09-03 23:24:48 +02:00
update: change theme
This commit is contained in:
parent
aca521b54f
commit
9426b73940
17 changed files with 326 additions and 21 deletions
|
|
@ -39,3 +39,21 @@ function youtubeThumbnailUrl(url) {
|
|||
const videoId = youtubeVideoId(url);
|
||||
return videoId ? `https://img.youtube.com/vi/${videoId}/mqdefault.jpg` : null;
|
||||
}
|
||||
|
||||
function initials(name) {
|
||||
return String(name || '?')
|
||||
.trim()
|
||||
.split(/\s+/)
|
||||
.filter(Boolean)
|
||||
.slice(0, 2)
|
||||
.map((w) => w[0].toUpperCase())
|
||||
.join('') || '?';
|
||||
}
|
||||
|
||||
function avatarHtml(user, extraClass) {
|
||||
const cls = `avatar${extraClass ? ` ${extraClass}` : ''}`;
|
||||
if (user.avatarUrl) {
|
||||
return `<img class="${cls}" src="${escapeHtml(user.avatarUrl)}" alt="${escapeHtml(user.name)}" loading="lazy">`;
|
||||
}
|
||||
return `<span class="${cls} avatar-initials">${escapeHtml(initials(user.name))}</span>`;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue