diff options
author | Devaev Maxim <[email protected]> | 2018-12-01 13:08:35 +0300 |
---|---|---|
committer | Devaev Maxim <[email protected]> | 2018-12-01 13:08:35 +0300 |
commit | ad6a66ac8fcf7726540f750a6d83e5f80fb0cd71 (patch) | |
tree | 4399c5ef84385c90b867c4b6ef769cd68923469b | |
parent | a6d4545bafe750f894654fa3cddbfe15a89e6e6e (diff) |
ui -> wm
-rw-r--r-- | testenv/eslintrc.yaml | 4 | ||||
-rw-r--r-- | web/js/kvm/atx.js | 12 | ||||
-rw-r--r-- | web/js/kvm/hid.js | 18 | ||||
-rw-r--r-- | web/js/kvm/main.js | 12 | ||||
-rw-r--r-- | web/js/kvm/msd.js | 22 | ||||
-rw-r--r-- | web/js/kvm/stream.js | 24 | ||||
-rw-r--r-- | web/js/wm.js (renamed from web/js/ui.js) | 2 | ||||
-rw-r--r-- | web/kvm/index.html | 2 |
8 files changed, 48 insertions, 48 deletions
diff --git a/testenv/eslintrc.yaml b/testenv/eslintrc.yaml index 2ef7c7fc..44e1be8a 100644 --- a/testenv/eslintrc.yaml +++ b/testenv/eslintrc.yaml @@ -6,8 +6,8 @@ globals: Msd: true Session: true Streamer: true - Ui: true - ui: true + WindowManager: true + wm: true tools: true checkBrowser: true "$": true diff --git a/web/js/kvm/atx.js b/web/js/kvm/atx.js index 9ef0c063..6a641ac9 100644 --- a/web/js/kvm/atx.js +++ b/web/js/kvm/atx.js @@ -18,9 +18,9 @@ function Atx() { $("atx-power-led").className = (state.leds.power ? "led-green" : "led-gray"); $("atx-hdd-led").className = (state.leds.hdd ? "led-red" : "led-gray"); - ui.switchDisabled($("atx-power-button"), state.busy); - ui.switchDisabled($("atx-power-button-long"), state.busy); - ui.switchDisabled($("atx-reset-button"), state.busy); + wm.switchDisabled($("atx-power-button"), state.busy); + wm.switchDisabled($("atx-power-button-long"), state.busy); + wm.switchDisabled($("atx-reset-button"), state.busy); }; self.clearState = function() { @@ -29,14 +29,14 @@ function Atx() { }; var __clickButton = function(button, confirm_msg) { - ui.confirm(confirm_msg).then(function(ok) { + wm.confirm(confirm_msg).then(function(ok) { if (ok) { var http = tools.makeRequest("POST", "/kvmd/atx/click?button=" + button, function() { if (http.readyState === 4) { if (http.status === 409) { - ui.error("Performing another ATX operation for other client.<br>Please try again later"); + wm.error("Performing another ATX operation for other client.<br>Please try again later"); } else if (http.status !== 200) { - ui.error("Click error:<br>", http.responseText); + wm.error("Click error:<br>", http.responseText); } } }); diff --git a/web/js/kvm/hid.js b/web/js/kvm/hid.js index c837b809..49d659ab 100644 --- a/web/js/kvm/hid.js +++ b/web/js/kvm/hid.js @@ -54,9 +54,9 @@ function Hid() { /********************************************************************************/ self.setSocket = function(ws) { - ui.switchDisabled($("hid-pak-text"), !ws); - ui.switchDisabled($("hid-pak-button"), !ws); - ui.switchDisabled($("hid-reset-button"), !ws); + wm.switchDisabled($("hid-pak-text"), !ws); + wm.switchDisabled($("hid-pak-button"), !ws); + wm.switchDisabled($("hid-reset-button"), !ws); __ws = ws; __keyboard.setSocket(ws); __mouse.setSocket(ws); @@ -152,10 +152,10 @@ function Hid() { Are you sure you want to continue? `; - ui.confirm(confirm_msg).then(function(ok) { + wm.confirm(confirm_msg).then(function(ok) { if (ok) { - ui.switchDisabled($("hid-pak-text"), true); - ui.switchDisabled($("hid-pak-button"), true); + wm.switchDisabled($("hid-pak-text"), true); + wm.switchDisabled($("hid-pak-button"), true); $("hid-pak-led").className = "led-yellow-rotating-fast"; $("hid-pak-led").title = "Autotyping..."; @@ -169,8 +169,8 @@ function Hid() { iterate(); } else { $("hid-pak-text").value = ""; - ui.switchDisabled($("hid-pak-text"), false); - ui.switchDisabled($("hid-pak-button"), false); + wm.switchDisabled($("hid-pak-text"), false); + wm.switchDisabled($("hid-pak-button"), false); $("hid-pak-led").className = "led-gray"; $("hid-pak-led").title = ""; } @@ -188,7 +188,7 @@ function Hid() { var http = tools.makeRequest("POST", "/kvmd/hid/reset", function() { if (http.readyState === 4) { if (http.status !== 200) { - ui.error("HID reset error:<br>", http.responseText); + wm.error("HID reset error:<br>", http.responseText); } } }); diff --git a/web/js/kvm/main.js b/web/js/kvm/main.js index fe6b595c..5c6d775a 100644 --- a/web/js/kvm/main.js +++ b/web/js/kvm/main.js @@ -1,15 +1,15 @@ -var ui; +var wm; function main() { if (checkBrowser()) { - ui = new Ui(); + wm = new WindowManager(); - tools.setOnClick($("show-about-button"), () => ui.showWindow($("about-window"))); - tools.setOnClick($("show-keyboard-button"), () => ui.showWindow($("keyboard-window"))); - tools.setOnClick($("show-stream-button"), () => ui.showWindow($("stream-window"))); + 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("/kvmd/log?seek=3600&follow=1", "_blank")); - ui.showWindow($("stream-window")); + wm.showWindow($("stream-window")); new Session(); } diff --git a/web/js/kvm/msd.js b/web/js/kvm/msd.js index 4ce5d464..39578cdd 100644 --- a/web/js/kvm/msd.js +++ b/web/js/kvm/msd.js @@ -55,20 +55,20 @@ function Msd() { var http = tools.makeRequest("POST", "/kvmd/msd/connect?to=" + to, function() { if (http.readyState === 4) { if (http.status !== 200) { - ui.error("Switch error:<br>", http.responseText); + wm.error("Switch error:<br>", http.responseText); } } __applyState(); }); __applyState(); - ui.switchDisabled($(`msd-switch-to-${to}-button`), true); + wm.switchDisabled($(`msd-switch-to-${to}-button`), true); }; var __selectNewImageFile = function() { var el_input = $("msd-select-new-image-file"); var image_file = (el_input.files.length ? el_input.files[0] : null); if (image_file && image_file.size > __state.info.size) { - ui.error("New image is too big for your Mass Storage Device.<br>Maximum:", __formatSize(__state.info.size)); + wm.error("New image is too big for your Mass Storage Device.<br>Maximum:", __formatSize(__state.info.size)); el_input.value = ""; image_file = null; } @@ -80,7 +80,7 @@ function Msd() { var http = tools.makeRequest("POST", "/kvmd/msd/reset", function() { if (http.readyState === 4) { if (http.status !== 200) { - ui.error("MSD reset error:<br>", http.responseText); + wm.error("MSD reset error:<br>", http.responseText); } } __applyState(); @@ -120,12 +120,12 @@ function Msd() { $("msd-current-image-size").innerHTML = (__state.in_operate && __state.info.image ? __formatSize(__state.info.image.size) : "None"); $("msd-storage-size").innerHTML = (__state.in_operate ? __formatSize(__state.info.size) : "Unavailable"); - ui.switchDisabled($("msd-switch-to-kvm-button"), (!__state.in_operate || __state.connected_to === "kvm" || __state.busy)); - ui.switchDisabled($("msd-switch-to-server-button"), (!__state.in_operate || __state.connected_to === "server" || __state.busy)); - ui.switchDisabled($("msd-select-new-image-button"), (!__state.in_operate || __state.connected_to !== "kvm" || __state.busy || __upload_http)); - ui.switchDisabled($("msd-upload-new-image-button"), (!__state.in_operate || __state.connected_to !== "kvm" || __state.busy || !__image_file)); - ui.switchDisabled($("msd-abort-uploading-button"), (!__state.in_operate || !__upload_http)); - ui.switchDisabled($("msd-reset-button"), (!__state.in_operate || __upload_http)); + wm.switchDisabled($("msd-switch-to-kvm-button"), (!__state.in_operate || __state.connected_to === "kvm" || __state.busy)); + wm.switchDisabled($("msd-switch-to-server-button"), (!__state.in_operate || __state.connected_to === "server" || __state.busy)); + wm.switchDisabled($("msd-select-new-image-button"), (!__state.in_operate || __state.connected_to !== "kvm" || __state.busy || __upload_http)); + wm.switchDisabled($("msd-upload-new-image-button"), (!__state.in_operate || __state.connected_to !== "kvm" || __state.busy || !__image_file)); + wm.switchDisabled($("msd-abort-uploading-button"), (!__state.in_operate || !__upload_http)); + wm.switchDisabled($("msd-reset-button"), (!__state.in_operate || __upload_http)); $("msd-new-image").style.display = (__image_file ? "block" : "none"); $("msd-progress").setAttribute("data-label", "Waiting for upload ..."); @@ -146,7 +146,7 @@ function Msd() { var __uploadStateChange = function() { if (__upload_http.readyState === 4) { if (__upload_http.status !== 200) { - ui.error("Can't upload image to the Mass Storage Device:<br>", __upload_http.responseText); + wm.error("Can't upload image to the Mass Storage Device:<br>", __upload_http.responseText); } $("msd-select-new-image-file").value = ""; __image_file = null; diff --git a/web/js/kvm/stream.js b/web/js/kvm/stream.js index 52e01fc4..2133349a 100644 --- a/web/js/kvm/stream.js +++ b/web/js/kvm/stream.js @@ -49,7 +49,7 @@ function Streamer() { } if (!$("stream-quality-slider").activated) { - ui.switchDisabled($("stream-quality-slider"), false); + wm.switchDisabled($("stream-quality-slider"), false); if ($("stream-quality-slider").value !== source.quality) { $("stream-quality-slider").value = source.quality; __updateQualityValue(source.quality); @@ -57,7 +57,7 @@ function Streamer() { } if (!$("stream-desired-fps-slider").activated) { - ui.switchDisabled($("stream-desired-fps-slider"), false); + wm.switchDisabled($("stream-desired-fps-slider"), false); if ($("stream-desired-fps-slider").value !== source.desired_fps) { $("stream-desired-fps-slider").value = source.desired_fps; __updateDesiredFpsValue(source.desired_fps); @@ -101,8 +101,8 @@ function Streamer() { $("stream-box").classList.remove("stream-box-inactive"); $("stream-led").className = "led-green"; $("stream-led").title = "Stream is active"; - ui.switchDisabled($("stream-screenshot-button"), false); - ui.switchDisabled($("stream-reset-button"), false); + wm.switchDisabled($("stream-screenshot-button"), false); + wm.switchDisabled($("stream-reset-button"), false); tools.info("Stream: acquired"); __prev = true; } @@ -121,10 +121,10 @@ function Streamer() { $("stream-box").classList.add("stream-box-inactive"); $("stream-led").className = "led-gray"; $("stream-led").title = "Stream inactive"; - ui.switchDisabled($("stream-screenshot-button"), true); - ui.switchDisabled($("stream-reset-button"), true); - ui.switchDisabled($("stream-quality-slider"), true); - ui.switchDisabled($("stream-desired-fps-slider"), true); + wm.switchDisabled($("stream-screenshot-button"), true); + wm.switchDisabled($("stream-reset-button"), true); + wm.switchDisabled($("stream-quality-slider"), true); + wm.switchDisabled($("stream-desired-fps-slider"), true); __client_key = tools.makeId(); __client_id = ""; @@ -165,7 +165,7 @@ function Streamer() { var http = tools.makeRequest("POST", "/kvmd/streamer/reset", function() { if (http.readyState === 4) { if (http.status !== 200) { - ui.error("Can't reset stream:<br>", http.responseText); + wm.error("Can't reset stream:<br>", http.responseText); } } }); @@ -175,7 +175,7 @@ function Streamer() { var http = tools.makeRequest("POST", `/kvmd/streamer/set_params?${name}=${value}`, function() { if (http.readyState === 4) { if (http.status !== 200) { - ui.error("Can't configure stream:<br>", http.responseText); + wm.error("Can't configure stream:<br>", http.responseText); } } }); @@ -191,7 +191,7 @@ function Streamer() { var __adjustSizeFactor = function() { var el_window = $("stream-window"); var el_slider = $("stream-size-slider"); - var view = ui.getViewGeometry(); + var view = wm.getViewGeometry(); for (var size = 100; size >= el_slider.min; size -= el_slider.step) { tools.info("Stream: adjusting size:", size); @@ -214,7 +214,7 @@ function Streamer() { var el_stream_image = $("stream-image"); el_stream_image.style.width = __resolution.width * __size_factor + "px"; el_stream_image.style.height = __resolution.height * __size_factor + "px"; - ui.showWindow($("stream-window"), false, center); + wm.showWindow($("stream-window"), false, center); }; __init__(); diff --git a/web/js/ui.js b/web/js/wm.js index efbb1a6c..002009c2 100644 --- a/web/js/ui.js +++ b/web/js/wm.js @@ -1,4 +1,4 @@ -function Ui() { +function WindowManager() { var self = this; /********************************************************************************/ diff --git a/web/kvm/index.html b/web/kvm/index.html index 6b67cfff..d8807e03 100644 --- a/web/kvm/index.html +++ b/web/kvm/index.html @@ -29,7 +29,7 @@ <script src="../js/bb.js"></script> <script src="../js/tools.js"></script> - <script src="../js/ui.js"></script> + <script src="../js/wm.js"></script> <script src="../js/kvm/stream.js"></script> <script src="../js/kvm/atx.js"></script> <script src="../js/kvm/keyboard.js"></script> |