Fixed #117 as @lil-bandit mentioned

This commit is contained in:
Yami Odymel 2025-06-25 06:21:03 +08:00
parent 8502d4429f
commit 6aebcd723e
No known key found for this signature in database
GPG Key ID: 68E469836934DB36

View File

@ -284,10 +284,13 @@
<script>
// before content was swapped by HTMX
document.body.addEventListener("htmx:sseBeforeMessage", function (e) {
// stop it if "auto-update" was unchecked
if (!e.detail.elt.closest(".ts-box").querySelector("[type=checkbox]").checked) {
e.preventDefault()
return
// ignore anything with `-log` content swap if "auto-update" was unchecked
let sswe_id = e.detail.elt.getAttribute('sse-swap')
if (sswe_id && sswe_id.endsWith("-log") ) {
if (!e.detail.elt.closest(".ts-box").querySelector("[type=checkbox]").checked) {
e.preventDefault()
return
}
}
// else scroll the textarea to bottom with async trick
setTimeout(() => {