summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--kvmd/web/index.html6
-rw-r--r--kvmd/web/js/ui.js8
2 files changed, 9 insertions, 5 deletions
diff --git a/kvmd/web/index.html b/kvmd/web/index.html
index 05507b07..db1d5e06 100644
--- a/kvmd/web/index.html
+++ b/kvmd/web/index.html
@@ -37,7 +37,7 @@
<li class="ctl-right-actions">
<div class="ctl-dropdown">
- <a class="ctl-item" href="#" onclick="ui.toggleMenu(this);">
+ <a class="ctl-item" href="#">
<img data-dont-hide-menu id="stream-led" class="led-off" src="svg/stream-led.svg" />
<img data-dont-hide-menu id="hid-keyboard-led" class="led-off" src="svg/hid-keyboard-led.svg" />
<img data-dont-hide-menu id="hid-mouse-led" class="led-off" src="svg/hid-mouse-led.svg" />
@@ -51,7 +51,7 @@
<li class="ctl-right-actions">
<div class="ctl-dropdown">
- <a class="ctl-item" href="#" onclick="ui.toggleMenu(this);">
+ <a class="ctl-item" href="#">
<img data-dont-hide-menu id="atx-power-led" class="led-off" src="svg/atx-power-led.svg" />
<img data-dont-hide-menu id="atx-hdd-led" class="led-off" src="svg/atx-hdd-led.svg" />
ATX &#8628;
@@ -67,7 +67,7 @@
<li class="ctl-right-actions">
<div class="ctl-dropdown">
- <a class="ctl-item" href="#" onclick="ui.toggleMenu(this);">
+ <a class="ctl-item" href="#">
<img data-dont-hide-menu id="msd-led" class="led-off" src="svg/msd-led.svg" />
Mass Storage &#8628;
</a>
diff --git a/kvmd/web/js/ui.js b/kvmd/web/js/ui.js
index e6b3de33..dd7d7a4d 100644
--- a/kvmd/web/js/ui.js
+++ b/kvmd/web/js/ui.js
@@ -1,5 +1,9 @@
var ui = new function() {
this.init = function() {
+ Array.prototype.forEach.call(document.getElementsByClassName("ctl-item"), function(el_item) {
+ el_item.onclick = function() { __toggleMenu(el_item); };
+ });
+
window.onclick = __windowClickHandler;
Array.prototype.forEach.call(document.getElementsByClassName("window"), function(el_window) {
@@ -8,7 +12,7 @@ var ui = new function() {
});
};
- this.toggleMenu = function(el_a) {
+ var __toggleMenu = function(el_a) {
Array.prototype.forEach.call(document.getElementsByClassName("ctl-item"), function(el_item) {
var el_menu = el_item.parentElement.querySelector(".ctl-dropdown-content");
if (el_item === el_a && el_menu.style.display === "none") {
@@ -31,7 +35,7 @@ var ui = new function() {
return;
}
}
- ui.toggleMenu(null);
+ __toggleMenu(null);
}
};