Better VN mode autoscrolling

This commit is contained in:
Cohee
2023-06-27 00:57:16 +03:00
parent 59dba15a4f
commit 847961861f

View File

@@ -1378,8 +1378,18 @@ function formatGenerationTimer(gen_started, gen_finished) {
function scrollChatToBottom() { function scrollChatToBottom() {
if (power_user.auto_scroll_chat_to_bottom) { if (power_user.auto_scroll_chat_to_bottom) {
var $textchat = $("#chat"); const chatElement = $("#chat");
$textchat.scrollTop(($textchat[0].scrollHeight)); let position = chatElement[0].scrollHeight;
if (power_user.waifuMode) {
const lastMessage = chatElement.find('.mes').last();
if (lastMessage.length) {
const lastMessagePosition = lastMessage.position().top;
position = chatElement.scrollTop() + lastMessagePosition;
}
}
chatElement.scrollTop(position);
} }
} }