diff --git a/static/anonkunQM.js b/static/anonkunQM.js index d368d7f..146a717 100644 --- a/static/anonkunQM.js +++ b/static/anonkunQM.js @@ -18,7 +18,9 @@ var tid = setInterval( function () { let mbox = document.getElementById('chatWindow'); mbox.innerHTML = mbox.innerHTML + msg_str; - mbox.scrollTop = mbox.scrollHeight; + if ((mbox.scrollTop + mbox.offsetHeight) >= (mbox.scrollHeight - mbox.clientHeight / 2)) { + mbox.scrollTop = mbox.scrollHeight; + } }); socket.on('new_post', function(data) { deactivate_post(); @@ -143,6 +145,7 @@ var tid = setInterval( function () { let text = mtarea.value.trim(); mtarea.value = ''; if (text == '') { return; } + document.getElementById('chatWindow').scrollTop = document.getElementById('chatWindow').scrollHeight; socket.emit('message', {message: text, name: 'Anonymous', room: room_id}); } }); diff --git a/static/anonkunUser.js b/static/anonkunUser.js index 813512e..803f3d4 100644 --- a/static/anonkunUser.js +++ b/static/anonkunUser.js @@ -18,7 +18,9 @@ var tid = setInterval( function () { let mbox = document.getElementById('chatWindow'); mbox.innerHTML = mbox.innerHTML + msg_str; - mbox.scrollTop = mbox.scrollHeight; + if ((mbox.scrollTop + mbox.offsetHeight) >= (mbox.scrollHeight - mbox.clientHeight / 2)) { + mbox.scrollTop = mbox.scrollHeight; + } }); socket.on('new_post', function(data) { deactivate_post(); @@ -129,6 +131,7 @@ var tid = setInterval( function () { let text = mtarea.value.trim(); mtarea.value = ''; if (text == '') { return; } + document.getElementById('chatWindow').scrollTop = document.getElementById('chatWindow').scrollHeight; socket.emit('message', {message: text, name: 'Anonymous', room: room_id}); } }); diff --git a/todo b/todo index 91f83a8..fa22a96 100644 --- a/todo +++ b/todo @@ -12,13 +12,13 @@ Enable namefagging Account managament/logout Display profile link in header bar Tagging system +Quote backlinks Improvements: Revamp post editing More options for text posts (lists and so on) More rigorous input checking in events.py New post displays chat message -New chat message doesn't take chat window to the bottom if it was scrolled up Record email on signup Change urls Poll vote highlights entire option