Sponsor chat: composer grows with the message (up to 45% of the screen) and can be dragged taller
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
+8
-1
@@ -2149,7 +2149,13 @@
|
||||
function setChatBadge(n) { const b = $('chatNavBadge'); if (b) { b.hidden = !n; b.textContent = n > 9 ? '9+' : n; } }
|
||||
function stopPoll() { if (CHAT_POLL) { clearInterval(CHAT_POLL); CHAT_POLL = null; } }
|
||||
function startPoll() { stopPoll(); CHAT_POLL = setInterval(() => pullThread(false), 4000); }
|
||||
function autoGrow(el) { el.style.height = 'auto'; el.style.height = Math.min(120, el.scrollHeight) + 'px'; }
|
||||
// the composer grows with the message up to ~45% of the screen, and keeps any height the member dragged it to (Bradley, 2026-09-13)
|
||||
function autoGrow(el) {
|
||||
const cap = Math.max(160, Math.floor(window.innerHeight * 0.45));
|
||||
const dragged = Number(el.dataset.dragged || 0);
|
||||
el.style.height = 'auto';
|
||||
el.style.height = Math.min(cap, Math.max(dragged, el.scrollHeight)) + 'px';
|
||||
}
|
||||
function closeDrawer() { stopPoll(); if ($('chatDrawer')) $('chatDrawer').hidden = true; CHAT_OTHER = null; loadDashboard(); }
|
||||
|
||||
async function openThreads() {
|
||||
@@ -2259,6 +2265,7 @@
|
||||
const inp = $('chatInput');
|
||||
if (inp) {
|
||||
inp.addEventListener('input', () => autoGrow(inp));
|
||||
inp.addEventListener('mouseup', () => { const h = inp.getBoundingClientRect().height; inp.dataset.dragged = h > 60 ? String(Math.round(h)) : ''; });
|
||||
inp.addEventListener('keydown', e => { if (e.key === 'Enter' && !e.shiftKey) { e.preventDefault(); chatSend(); } });
|
||||
}
|
||||
on('qaMsgSponsor', 'click', () => { const q = $('qaMsgSponsor'); if (q.dataset.email) openConvo(q.dataset.email, q.dataset.name || 'your sponsor'); });
|
||||
|
||||
Reference in New Issue
Block a user