aboutsummaryrefslogtreecommitdiffstats
path: root/src/client/Buttons.hx
diff options
context:
space:
mode:
authorRblSb <msrblsb@gmail.com>2020-03-11 07:18:33 +0300
committerRblSb <msrblsb@gmail.com>2020-03-11 07:18:33 +0300
commit43d38010b20ca15c1aa909a578afeb5edd8c8bd3 (patch)
tree6e2c944cd3a94cf15f55e560ff664bd0860db1b0 /src/client/Buttons.hx
parent1fb3e2de251f5f1d33a43cd13bc4ca6d3ae23c26 (diff)
Emotes lazy load
Diffstat (limited to 'src/client/Buttons.hx')
-rw-r--r--src/client/Buttons.hx12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/client/Buttons.hx b/src/client/Buttons.hx
index b8e4a16..b5656e1 100644
--- a/src/client/Buttons.hx
+++ b/src/client/Buttons.hx
@@ -1,5 +1,6 @@
package client;
+import js.html.ImageElement;
import haxe.Timer;
import js.html.KeyboardEvent;
import js.html.InputElement;
@@ -30,11 +31,16 @@ class Buttons {
final smilesBtn = ge("#smilesbtn");
smilesBtn.onclick = e -> {
- smilesBtn.classList.toggle("active");
final smilesWrap = ge("#smileswrap");
- if (smilesBtn.classList.contains("active"))
- smilesWrap.style.display = "block";
+ if (smilesWrap.children.length == 0) return;
+ final isActive = smilesBtn.classList.toggle("active");
+ if (isActive) smilesWrap.style.display = "block";
else smilesWrap.style.display = "none";
+ if (smilesWrap.firstElementChild.dataset.src == null) return;
+ for (child in smilesWrap.children) {
+ (cast child : ImageElement).src = child.dataset.src;
+ child.removeAttribute("data-src");
+ }
}
ge("#clearchatbtn").onclick = e -> {
send patches to the email below
yukais@pinapelz.com
include the subject [PATCH repo_name]
pinapelz.com
homepage