From 5dc123e1860be5e582de1ed4341296c3c3f649da Mon Sep 17 00:00:00 2001 From: Devaev Maxim Date: Tue, 13 Apr 2021 10:14:27 +0300 Subject: refactoring --- web/kvm/index.html | 6 +++--- web/kvm/window-about.pug | 2 +- web/kvm/window-keyboard.pug | 2 +- web/kvm/window-stream.pug | 2 +- web/share/js/kvm/main.js | 3 --- web/share/js/wm.js | 5 +++++ 6 files changed, 11 insertions(+), 9 deletions(-) (limited to 'web') diff --git a/web/kvm/index.html b/web/kvm/index.html index fdfb5dd9..3fd7a57c 100644 --- a/web/kvm/index.html +++ b/web/kvm/index.html @@ -456,7 +456,7 @@ -
+
Stream
@@ -494,7 +494,7 @@
-
+
Virtual Keyboard
@@ -1338,7 +1338,7 @@
-
+
About
diff --git a/web/kvm/window-about.pug b/web/kvm/window-about.pug index 17d1c04b..0c7da8bf 100644 --- a/web/kvm/window-about.pug +++ b/web/kvm/window-about.pug @@ -9,7 +9,7 @@ mixin about_tab(name, title, checked=false) else span(class="code-comment") No data -div(id="about-window" class="window") +div(id="about-window" class="window" data-show-by-button="show-about-button") div(class="window-header") div(class="window-grab") About button(class="window-button-close") × diff --git a/web/kvm/window-keyboard.pug b/web/kvm/window-keyboard.pug index 986ca91f..95322f2b 100644 --- a/web/kvm/window-keyboard.pug +++ b/web/kvm/window-keyboard.pug @@ -15,7 +15,7 @@ mixin empty_key(width=0) mixin lamp(cls) img(class=`inline-lamp ${cls} led-gray` src=`${svg_dir}/led-square.svg`) -div(id="keyboard-window" class="window") +div(id="keyboard-window" class="window" data-show-by-button="show-keyboard-button") div(id="keyboard-window-header" class="window-header") div(class="window-grab") Virtual Keyboard button(class="window-button-close") × diff --git a/web/kvm/window-stream.pug b/web/kvm/window-stream.pug index 2595fe3b..dc083600 100644 --- a/web/kvm/window-stream.pug +++ b/web/kvm/window-stream.pug @@ -2,7 +2,7 @@ - confirm_msg += "the video transmission until you open the broadcast again.
"; - confirm_msg += "This can be useful for saving traffic."; -div(id="stream-window" class="window window-resizable" data-close-confirm=confirm_msg) +div(id="stream-window" class="window window-resizable" data-close-confirm=confirm_msg data-show-by-button="show-stream-button") div(id="stream-window-header" class="window-header") div(class="window-grab") Stream button(class="window-button-close") × diff --git a/web/share/js/kvm/main.js b/web/share/js/kvm/main.js index dde873c7..8150a852 100644 --- a/web/share/js/kvm/main.js +++ b/web/share/js/kvm/main.js @@ -40,9 +40,6 @@ export function main() { initWindowManager(); - tools.setOnClick($("show-about-button"), () => wm.showWindow($("about-window"))); - tools.setOnClick($("show-keyboard-button"), () => wm.showWindow($("keyboard-window"))); - tools.setOnClick($("show-stream-button"), () => wm.showWindow($("stream-window"))); tools.setOnClick($("open-log-button"), () => window.open("/api/log?seek=3600&follow=1", "_blank")); wm.showWindow($("stream-window")); diff --git a/web/share/js/wm.js b/web/share/js/wm.js index 11d86155..b74e2626 100644 --- a/web/share/js/wm.js +++ b/web/share/js/wm.js @@ -63,6 +63,11 @@ function __WindowManager() { __makeWindowMovable(el_window); __windows.push(el_window); + if (el_window.hasAttribute("data-show-by-button")) { + let el_show_button = $(el_window.getAttribute("data-show-by-button")); + tools.setOnClick(el_show_button, () => self.showWindow(el_window)); + } + if (el_window.classList.contains("window-resizable") && window.ResizeObserver) { new ResizeObserver(function() { // При переполнении рабочей области сократить размер окна по высоте. -- cgit v1.2.3