aboutsummaryrefslogtreecommitdiffstats
path: root/src/client/Buttons.hx
diff options
context:
space:
mode:
authorRblSb <msrblsb@gmail.com>2020-03-02 19:08:03 +0300
committerRblSb <msrblsb@gmail.com>2020-03-02 19:08:03 +0300
commit22aa8b4a4a0ec8bf6c082e75858b2c2803b1904c (patch)
tree4808eaf5452545b087ae65b7b09296287e9f24eb /src/client/Buttons.hx
parentb239467d9917849a746f2026c7f0b185a6341914 (diff)
Basic dropdown menu
Diffstat (limited to 'src/client/Buttons.hx')
-rw-r--r--src/client/Buttons.hx19
1 files changed, 15 insertions, 4 deletions
diff --git a/src/client/Buttons.hx b/src/client/Buttons.hx
index d566d68..31f1e86 100644
--- a/src/client/Buttons.hx
+++ b/src/client/Buttons.hx
@@ -168,15 +168,27 @@ class Buttons {
ge("#userlist").style.height = '${height}px';
}
+ static function onClick(el:Element, func:Any->Void):Void {
+ final isTouch = untyped __js__("'ontouchstart' in window");
+ if (!isTouch) el.onclick = func;
+ else el.ontouchend = func;
+ }
+
static function initNavBar(main:Main):Void {
+ final toggleMenu = ge("#toggleMenu");
+ final onclick = e -> {
+ ge("#nav-collapsible").classList.toggle("in");
+ }
+ onClick(toggleMenu, onclick);
+
final classes:Array<Element> = cast document.querySelectorAll(".dropdown-toggle");
for (klass in classes) {
klass.onclick = e -> {
- klass.classList.toggle("focus");
+ final isActive = klass.classList.toggle("focus");
hideMenus();
final menu = klass.parentElement.querySelector(".dropdown-menu");
- if (menu.style.display == "") menu.style.display = "block";
- else menu.style.display = "";
+ if (isActive) menu.style.display = "block";
+ else menu.style.display = "none";
}
klass.onmouseover = klass.onclick;
}
@@ -206,7 +218,6 @@ class Buttons {
updateSynchThresholdBtn(main);
synchThresholdBtn.blur();
}
- final text = synchThresholdBtn.innerText;
final secs = main.synchThreshold;
synchThresholdBtn.innerText += ': ${secs}s';
send patches to the email below
yukais@pinapelz.com
include the subject [PATCH repo_name]
pinapelz.com
homepage