diff options
author | Elizabeth Hunt <elizabeth.hunt@simponic.xyz> | 2025-01-05 15:16:26 -0800 |
---|---|---|
committer | Elizabeth Hunt <elizabeth.hunt@simponic.xyz> | 2025-01-05 15:29:23 -0800 |
commit | 2984a715b830410b6d6ce2a8aaa1fc8a2388ee99 (patch) | |
tree | 09dc00606931885e8b345791cd1a301335dd494c /static | |
parent | d86746bb0ddcb7dcfc6225f9fe37f6034c958913 (diff) | |
download | phoneof-2984a715b830410b6d6ce2a8aaa1fc8a2388ee99.tar.gz phoneof-2984a715b830410b6d6ce2a8aaa1fc8a2388ee99.zip |
add ntfy integration
Diffstat (limited to 'static')
-rw-r--r-- | static/js/components/chat.js | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/static/js/components/chat.js b/static/js/components/chat.js index bdc8ad1..e5d1185 100644 --- a/static/js/components/chat.js +++ b/static/js/components/chat.js @@ -6,14 +6,14 @@ const runChat = async () => { r.text(), ); - const { scrollTop, scrollHeight } = document.getElementById( + const { scrollTop, scrollTopMax } = document.getElementById( "chat-container", ) ?? { scrollTop: 0 }; - const isAtEdge = scrollTop === scrollHeight || scrollTop === 0; + const isAtEdge = scrollTop > (0.92 * scrollTopMax) || scrollTop === 0; document.getElementById("messages").innerHTML = html; if (isAtEdge) { document.getElementById("chat-container").scrollTop = - document.getElementById("chat-container").scrollHeight; + document.getElementById("chat-container").scrollTopMax; } else { // save the position. document.getElementById("chat-container").scrollTop = scrollTop; |