Presentation sponsor card: a capped bio ends on a whole word with an ellipsis

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
martbost
2026-10-15 14:57:13 -05:00
parent bb11f8183d
commit be268beb66
2 changed files with 4 additions and 2 deletions
+3 -1
View File
@@ -43,7 +43,9 @@
const tok = ref || (sp && sp.ref) || '';
if (sp && sp.name && tok && !sp.own) {
$('prHead').innerHTML = 'Shared with you by <b>' + esc(sp.name) + '</b>';
$('prText').textContent = sp.bio ? sp.bio : 'They can help you get set up in a few minutes, and they will be your sponsor on every platform in the network.';
// /api/sponsor caps the bio at 220 characters, so a capped bio ends mid-word: trim it back to a word and add an ellipsis
const bio = sp.bio && sp.bio.length >= 220 ? sp.bio.slice(0, sp.bio.lastIndexOf(' ')).replace(/[\s,;:.—-]+$/, '') + '…' : sp.bio;
$('prText').textContent = bio ? bio : 'They can help you get set up in a few minutes, and they will be your sponsor on every platform in the network.';
$('prJoin').textContent = 'Join with ' + sp.name;
$('prJoin').href = '/join/' + encodeURIComponent(tok) + '?v=wide';
$('prIni').textContent = String(sp.name).replace(/^@/, '').slice(0, 1).toUpperCase() || '?';