From dcfd0265fad6d48253a499f6cb65751f5bd7774f Mon Sep 17 00:00:00 2001 From: Hendrik Langer Date: Thu, 6 Aug 2020 16:27:10 +0200 Subject: [PATCH] remove old chat messages --- raspberry/roberto/views/frontend/templates/index.html | 3 +++ 1 file changed, 3 insertions(+) diff --git a/raspberry/roberto/views/frontend/templates/index.html b/raspberry/roberto/views/frontend/templates/index.html index fbe91c7..447b20d 100644 --- a/raspberry/roberto/views/frontend/templates/index.html +++ b/raspberry/roberto/views/frontend/templates/index.html @@ -200,6 +200,9 @@ socket.on('text', (data) => { var new_message = document.createElement('p'); new_message.innerHTML = data.data; chatlog.append(new_message); + if (chatlog.children.length > 10) { + chatlog.children[0].remove(); + } }); function displayText(text, left, top) {