new chat messages don't force chat window to bottom if it was scrolled up

This commit is contained in:
iou1name 2018-07-22 02:58:54 -04:00
parent f7627d5090
commit c59f2dde99
3 changed files with 9 additions and 3 deletions

View File

@ -18,7 +18,9 @@ var tid = setInterval( function () {
let mbox = document.getElementById('chatWindow');
mbox.innerHTML = mbox.innerHTML + msg_str;
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});
}
});

View File

@ -18,7 +18,9 @@ var tid = setInterval( function () {
let mbox = document.getElementById('chatWindow');
mbox.innerHTML = mbox.innerHTML + msg_str;
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});
}
});

2
todo
View File

@ -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