summaryrefslogtreecommitdiff
path: root/web
diff options
context:
space:
mode:
authorMaxim Devaev <[email protected]>2022-11-18 04:42:40 +0300
committerMaxim Devaev <[email protected]>2022-11-18 04:42:40 +0300
commitb78a9dd8e1fbb1422552b501abafde052ec1a8eb (patch)
treecee87c328bf55de2286299c0997921c06f7ad9fa /web
parent0f4e7361856446a029e950233f532226614cf665 (diff)
web: ui config
Diffstat (limited to 'web')
-rw-r--r--web/share/js/index/main.js5
-rw-r--r--web/share/js/kvm/main.js3
-rw-r--r--web/share/js/tools.js10
-rw-r--r--web/share/js/wm.js21
4 files changed, 28 insertions, 11 deletions
diff --git a/web/share/js/index/main.js b/web/share/js/index/main.js
index 7510d133..08e4a364 100644
--- a/web/share/js/index/main.js
+++ b/web/share/js/index/main.js
@@ -74,7 +74,10 @@ function __loadKvmdInfo() {
$("apps-box").innerHTML = "<ul id=\"apps\"></ul>";
// Don't use this option, it may be removed in any time
- let hide_kvm_button = (info.meta !== null && info.meta.web && info.meta.web.hide_kvm_button);
+ let hide_kvm_button = (
+ (info.meta !== null && info.meta.web && info.meta.web.hide_kvm_button)
+ || tools.config.getBool("index--hide-kvm-button", false)
+ );
if (!hide_kvm_button) {
$("apps").innerHTML += __makeApp(null, "kvm", "share/svg/kvm.svg", "KVM");
}
diff --git a/web/share/js/kvm/main.js b/web/share/js/kvm/main.js
index 6417da37..cc5cd002 100644
--- a/web/share/js/kvm/main.js
+++ b/web/share/js/kvm/main.js
@@ -48,6 +48,9 @@ export function main() {
tools.el.setOnClick($("open-log-button"), () => window.open("/api/log?seek=3600&follow=1", "_blank"));
+ if (tools.config.getBool("kvm--full-tab-stream", false)) {
+ wm.toggleFullTabWindow($("stream-window"), true);
+ }
wm.showWindow($("stream-window"));
new Session();
diff --git a/web/share/js/tools.js b/web/share/js/tools.js
index f2805fc3..789c4b12 100644
--- a/web/share/js/tools.js
+++ b/web/share/js/tools.js
@@ -346,6 +346,16 @@ export var tools = new function() {
};
};
+ self.config = new function() {
+ return {
+ "get": function(key, default_value) {
+ let value = window.getComputedStyle(document.documentElement).getPropertyValue(`--config-ui--${key}`);
+ return (value || default_value);
+ },
+ "getBool": (key, default_value) => !!parseInt(self.config.get(key, (default_value ? "1" : "0"))),
+ };
+ };
+
self.browser = browser;
};
diff --git a/web/share/js/wm.js b/web/share/js/wm.js
index a193610c..c8a4c109 100644
--- a/web/share/js/wm.js
+++ b/web/share/js/wm.js
@@ -111,16 +111,8 @@ function __WindowManager() {
let el_exit_full_tab_button = el_window.querySelector(".window-button-exit-full-tab");
if (el_enter_full_tab_button && el_exit_full_tab_button) {
el_enter_full_tab_button.title = "Stretch to the entire tab";
- let toggle_full_tab = function(enabled) {
- el_window.classList.toggle("window-full-tab", enabled);
- __activateLastWindow(el_window);
- let el_navbar = $("navbar");
- if (el_navbar) {
- tools.hidden.setVisible(el_navbar, !enabled);
- }
- };
- tools.el.setOnClick(el_enter_full_tab_button, () => toggle_full_tab(true));
- tools.el.setOnClick(el_exit_full_tab_button, () => toggle_full_tab(false));
+ tools.el.setOnClick(el_enter_full_tab_button, () => self.toggleFullTabWindow(el_window, true));
+ tools.el.setOnClick(el_exit_full_tab_button, () => self.toggleFullTabWindow(el_window, false));
}
let el_full_screen_button = el_window.querySelector(".window-header .window-button-full-screen");
@@ -272,6 +264,15 @@ function __WindowManager() {
__activateLastWindow(el_window);
};
+ self.toggleFullTabWindow = function(el_window, enabled) {
+ el_window.classList.toggle("window-full-tab", enabled);
+ __activateLastWindow(el_window);
+ let el_navbar = $("navbar");
+ if (el_navbar) {
+ tools.hidden.setVisible(el_navbar, !enabled);
+ }
+ };
+
var __closeWindow = function(el_window) {
el_window.focus();
el_window.blur();