delete old chat messages

Aevann 2024-05-12 19:10:07 +03:00
parent a836edfc04
commit 7075cffadb
1 changed files with 4 additions and 1 deletions

View File

@ -121,7 +121,10 @@ socket.on('speak', function(json) {
register_new_elements(line2);
bs_trigger(line2)
if (scrolled_down || json.user_id == vid) {
if (scrolled_down && document.getElementsByClassName('chat-message').length > 250)
document.getElementsByClassName('chat-group')[0].remove()
if (scrolled_down || json.user_id == vid) {
box.scrollTo(0, box.scrollHeight)
setTimeout(function() {
box.scrollTo(0, box.scrollHeight)