s'more chat progress

This commit is contained in:
Rusty Striker 2024-10-01 22:16:35 +03:00
parent acf96db186
commit b4e6a3fe39
Signed by: RustyStriker
GPG key ID: 87E4D691632DFF15
5 changed files with 33 additions and 4 deletions

View file

@ -21,6 +21,20 @@
return false;
}
}
document.getElementById('login-username').onkeypress = (e) => {
if(e.key == 'Enter') {
document.getElementById('login-pass').focus();
return false;
}
}
document.getElementById('login-pass').onkeypress = (e) => {
if(e.key == 'Enter') {
onLoginClick();
return false;
}
}
// focus on the username field for the sake of just pressing enter multiple times
document.getElementById('login-username').focus();
}
tavern.onlogin = (s) => {
@ -29,8 +43,8 @@
let game = document.getElementById('game');
login.style.display = 'none';
game.style.display = 'flex';
// get all chat history as soon as we get in
tavern.get_chat_history(0, 0);
// get last 50 msgs (i think that is enough for now) when we get in
tavern.get_last_msgs(50);
}
else {
alert("Invalid username or password!");
@ -55,6 +69,7 @@
history.removeChild(exists);
}
history.appendChild(msg);
msg.scrollIntoView();
}
function onLoginClick() {
let username = document.getElementById('login-username').value;