Convert manual className editing to addClass and removeClass

This commit is contained in:
Midgard 2022-06-09 00:48:59 +02:00
parent 240745a404
commit 4480477e49
Signed by: midgard
GPG key ID: 511C112F1331BBB4

View file

@ -132,7 +132,11 @@ function isScrolledToBottom() {
return scrolledTo >= el.scrollHeight;
}
function checkScrolledToBottom() {
byId("channel_contents_wrapper").className = isScrolledToBottom() ? "" : "not-at-bottom";
if (isScrolledToBottom()) {
removeClass(byId("channel_contents_wrapper"), "not-at-bottom");
} else {
addClass(byId("channel_contents_wrapper"), "not-at-bottom");
}
}
byId("channel_contents_wrapper").addEventListener("scroll", checkScrolledToBottom);