master
Aevann1 2022-08-26 21:47:40 +02:00
parent c7359d90b7
commit bc743fc169
2 changed files with 7 additions and 14 deletions

View File

@ -68,8 +68,6 @@ socket.on('speak', function(json) {
let users = document.getElementsByClassName('userlink');
let last_user = users[users.length-1].innerHTML;
let scrolled_down = (box.scrollHeight - box.scrollTop <= window.innerHeight)
if (last_user == json['username']) {
document.getElementsByClassName('chat-line')[0].classList.remove('diff')
document.getElementsByClassName('userlink')[0].classList.add('d-none')
@ -93,14 +91,9 @@ socket.on('speak', function(json) {
let line = document.getElementsByClassName('chat-line')[0].cloneNode(true)
bs_trigger(line)
box.append(line)
if (scrolled_down) box.scrollTo(0, box.scrollHeight)
box.scrollTo(0, box.scrollHeight)
})
function scroll_chat() {
setTimeout(function () {
box.scrollTo(0, box.scrollHeight)
}, 0200);
}
function send() {
text = textbox.value.trim()
@ -112,8 +105,6 @@ function send() {
socket.emit('typing', false);
}
autoExpand(textbox);
box.scrollTo(0, box.scrollHeight);
scroll_chat();
}
function quote(t) {
@ -130,8 +121,6 @@ textbox.addEventListener("keyup", function(e) {
if (e.key === 'Enter') {
e.preventDefault();
send();
box.scrollTo(0, box.scrollHeight);
scroll_chat();
}
})
@ -189,6 +178,10 @@ socket.on('typing', function (users){
}
})
scroll_chat()
function scroll_chat() {
setTimeout(function () {
box.scrollTo(0, box.scrollHeight)
}, 200);
}
box.scrollTo(0, box.scrollHeight)

View File

@ -214,6 +214,6 @@
<script src="{{asset('js/lozad.js')}}"></script>
<script src="/assets/js/lite-youtube.js?v=241"></script>
<script src="/chat.js?v=3038"></script>
<script src="/chat.js?v=3039"></script>
</body>