aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRblSb <msrblsb@gmail.com>2020-05-23 22:33:44 +0300
committerRblSb <msrblsb@gmail.com>2020-05-23 22:33:44 +0300
commit5b94c5cc110f9367b844a622aa0ef4aabef34750 (patch)
tree495d14c2041959fe859957fb9ab96d80fffa03be
parent45080aa1f6d80f2ef64983904acbe1645c312d25 (diff)
Scroll to chat end on input touch
-rw-r--r--res/client.js8
-rw-r--r--res/css/des.css2
-rw-r--r--src/client/Buttons.hx10
-rw-r--r--src/client/Main.hx2
4 files changed, 16 insertions, 6 deletions
diff --git a/res/client.js b/res/client.js
index 318971b..0d19189 100644
--- a/res/client.js
+++ b/res/client.js
@@ -726,7 +726,13 @@ client_Buttons.initChatInput = function(main) {
guestPass.value = "";
}
};
- new client_InputWithHistory(window.document.querySelector("#chatline"),null,50,function(value) {
+ var chatline = window.document.querySelector("#chatline");
+ chatline.onfocus = function(e) {
+ if(client_Utils.isTouch()) {
+ main.scrollChatToEnd();
+ }
+ };
+ new client_InputWithHistory(chatline,null,50,function(value) {
main.send({ type : "Message", message : { clientName : "", text : value}});
return true;
});
diff --git a/res/css/des.css b/res/css/des.css
index 57e4446..70d0cff 100644
--- a/res/css/des.css
+++ b/res/css/des.css
@@ -506,7 +506,7 @@ footer#footer {
background-color: var(--background-chat);
overflow-y: scroll;
position: absolute;
- top: 3rem;
+ top: 4rem;
left: 1rem;
bottom: 1rem;
right: 1rem;
diff --git a/src/client/Buttons.hx b/src/client/Buttons.hx
index 625a71f..7e9c8cb 100644
--- a/src/client/Buttons.hx
+++ b/src/client/Buttons.hx
@@ -297,18 +297,22 @@ class Buttons {
static function initChatInput(main:Main):Void {
final guestName:InputElement = cast ge("#guestname");
guestName.onkeydown = e -> {
- if (e.keyCode == 13) main.guestLogin(guestName.value);
+ if (e.keyCode == KeyCode.Return) main.guestLogin(guestName.value);
}
final guestPass:InputElement = cast ge("#guestpass");
guestPass.onkeydown = e -> {
- if (e.keyCode == 13) {
+ if (e.keyCode == KeyCode.Return) {
main.userLogin(guestName.value, guestPass.value);
guestPass.value = "";
}
}
- new InputWithHistory(cast ge("#chatline"), 50, value -> {
+ final chatline:InputElement = cast ge("#chatline");
+ chatline.onfocus = e -> {
+ if (Utils.isTouch()) main.scrollChatToEnd();
+ }
+ new InputWithHistory(chatline, 50, value -> {
main.send({
type: Message,
message: {
diff --git a/src/client/Main.hx b/src/client/Main.hx
index 7e3a3be..527b898 100644
--- a/src/client/Main.hx
+++ b/src/client/Main.hx
@@ -156,7 +156,7 @@ class Main {
ge("#ce_queue_next").onclick = e -> addIframe(false);
ge("#ce_queue_end").onclick = e -> addIframe(true);
ge("#customembed-title").onkeydown = (e:KeyboardEvent) -> {
- if (e.keyCode == 13) {
+ if (e.keyCode == KeyCode.Return) {
addIframe(true);
e.preventDefault();
}
send patches to the email below
yukais@pinapelz.com
include the subject [PATCH repo_name]
pinapelz.com
homepage