Mercurial Hosting > lang
comparison src/chat.js @ 11:003a90ce72d7
minor fix
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Tue, 22 Jul 2025 15:30:10 -0600 |
parents | 46097e607701 |
children | 2d4b3f003ec2 |
comparison
equal
deleted
inserted
replaced
10:b0b325565d30 | 11:003a90ce72d7 |
---|---|
61 event.preventDefault(); | 61 event.preventDefault(); |
62 askAi(); | 62 askAi(); |
63 } | 63 } |
64 } | 64 } |
65 | 65 |
66 function fixTextarea(event) { | 66 function fixTextarea(textarea) { |
67 let textarea = event.target; | |
68 textarea.style.height = 'initial'; | 67 textarea.style.height = 'initial'; |
69 textarea.style.height = (textarea.scrollHeight+2) + 'px'; | 68 textarea.style.height = (textarea.scrollHeight+2) + 'px'; |
70 textarea.scrollIntoViewIfNeeded(false); | 69 textarea.scrollIntoViewIfNeeded(false); |
71 } | 70 } |
72 | 71 |
73 function askAi() { | 72 function askAi() { |
74 let input = document.querySelector('textarea'); | 73 let input = document.querySelector('textarea'); |
75 let url = `ai_ask.js?chat=${chatId}&input=${encodeURIComponent(input.value)}`; | 74 let url = `ai_ask.js?chat=${chatId}&input=${encodeURIComponent(input.value)}`; |
76 ajax(url); | 75 ajax(url); |
77 input.value = ''; | 76 input.value = ''; |
77 fixTextarea(input); | |
78 showWaitingAiIcon(); | 78 showWaitingAiIcon(); |
79 } | 79 } |