summaryrefslogtreecommitdiff
path: root/kvmd/web/js/ui.js
diff options
context:
space:
mode:
authorDevaev Maxim <[email protected]>2018-07-25 15:02:37 +0300
committerDevaev Maxim <[email protected]>2018-07-25 15:02:37 +0300
commitf04f5668f1c8d1063067e8bd202545a96ec0ab69 (patch)
treebffdfbab089731c7717915ade1dc1f95759e0662 /kvmd/web/js/ui.js
parent6c4385b52c9f58aa9fb825bcc5817c0e6e721e0d (diff)
refactoring
Diffstat (limited to 'kvmd/web/js/ui.js')
-rw-r--r--kvmd/web/js/ui.js8
1 files changed, 6 insertions, 2 deletions
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);
}
};