From 327b0aa6333c4def6b4c446d4524aa8a33af3d64 Mon Sep 17 00:00:00 2001 From: Chris Christiansen Date: Wed, 24 Jun 2026 16:34:15 +0000 Subject: [PATCH] fix(ui): Improve send button state handling --- static/opax.html | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/static/opax.html b/static/opax.html index 6e06b51..7790e69 100644 --- a/static/opax.html +++ b/static/opax.html @@ -403,7 +403,7 @@
-
@@ -1100,7 +1100,10 @@ function appendTyping(){ function rmTyping(){ document.getElementById('typing')?.remove() } const chatInp=document.getElementById('msg-input'),sbtn=document.getElementById('send-btn') -chatInp.addEventListener('input',()=>sbtn.disabled=!chatInp.value.trim()) + function updateSendBtn() { sbtn.disabled = !chatInp.value.trim() } + chatInp.addEventListener('input', updateSendBtn) + chatInp.addEventListener('keyup', updateSendBtn) + chatInp.addEventListener('paste', () => setTimeout(updateSendBtn, 0)) function autoResize(el){ el.style.height='auto';el.style.height=Math.min(el.scrollHeight,160)+'px' } function handleKey(e){ if(e.key==='Enter'&&!e.shiftKey){e.preventDefault();if(!sbtn.disabled)sendMessage()} } function suggest(btn){ chatInp.value=btn.textContent.trim();chatInp.dispatchEvent(new Event('input', { bubbles: true }));autoResize(chatInp);sbtn.disabled=false;sendMessage() } @@ -1128,8 +1131,9 @@ function exportHistory(){ const h=lh(),lines=h.map(m=>`[${new Date(m.ts).toISOString()}] ${m.role.toUpperCase()}: ${m.text}`) const a=document.createElement('a');a.href=URL.createObjectURL(new Blob([lines.join('\n\n')],{type:'text/plain'}));a.download='jason-historikk-'+new Date().toISOString().slice(0,10)+'.txt';a.click() } -;(function(){ const h=lh();if(!h.length)return;h.forEach(m=>appendMsg(m.role,m.text,m.ts));document.getElementById('messages').scrollTop=99999 })() +;(() => { const h = lh(); if (!h.length) return; h.forEach(m => appendMsg(m.role, m.text, m.ts)); document.getElementById('messages').scrollTop = 99999 })() chatInp.focus() +updateSendBtn() renderTierGrid(5000) updatePricing(5000)