diff options
author | Devaev Maxim <[email protected]> | 2018-07-25 15:02:37 +0300 |
---|---|---|
committer | Devaev Maxim <[email protected]> | 2018-07-25 15:02:37 +0300 |
commit | f04f5668f1c8d1063067e8bd202545a96ec0ab69 (patch) | |
tree | bffdfbab089731c7717915ade1dc1f95759e0662 /kvmd/web/js/ui.js | |
parent | 6c4385b52c9f58aa9fb825bcc5817c0e6e721e0d (diff) |
refactoring
Diffstat (limited to 'kvmd/web/js/ui.js')
-rw-r--r-- | kvmd/web/js/ui.js | 8 |
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); } }; |