mirror of
https://github.com/mofeng-git/One-KVM.git
synced 2025-12-12 09:10:30 +08:00
refactoring
This commit is contained in:
parent
dd4c797d26
commit
3ae6f3f881
@ -143,8 +143,8 @@
|
|||||||
<td>Auto-resize stream window:</td>
|
<td>Auto-resize stream window:</td>
|
||||||
<td align="right">
|
<td align="right">
|
||||||
<div class="switch-box">
|
<div class="switch-box">
|
||||||
<input checked type="checkbox" id="stream-auto-resize-checkbox">
|
<input checked type="checkbox" id="stream-auto-resize-switch">
|
||||||
<label for="stream-auto-resize-checkbox"><span class="switch-inner"></span><span class="switch"></span></label>
|
<label for="stream-auto-resize-switch"><span class="switch-inner"></span><span class="switch"></span></label>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</table>
|
</table>
|
||||||
@ -177,8 +177,8 @@
|
|||||||
<td>Squash relative mouse moves:</td>
|
<td>Squash relative mouse moves:</td>
|
||||||
<td align="right">
|
<td align="right">
|
||||||
<div class="switch-box">
|
<div class="switch-box">
|
||||||
<input checked type="checkbox" id="hid-mouse-squash-checkbox">
|
<input checked type="checkbox" id="hid-mouse-squash-switch">
|
||||||
<label for="hid-mouse-squash-checkbox"><span class="switch-inner"></span><span class="switch"></span></label>
|
<label for="hid-mouse-squash-switch"><span class="switch-inner"></span><span class="switch"></span></label>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</table>
|
</table>
|
||||||
@ -189,8 +189,8 @@
|
|||||||
<td>Connect HID to Server:</td>
|
<td>Connect HID to Server:</td>
|
||||||
<td align="right">
|
<td align="right">
|
||||||
<div class="switch-box">
|
<div class="switch-box">
|
||||||
<input checked type="checkbox" id="hid-connect-checkbox">
|
<input checked type="checkbox" id="hid-connect-switch">
|
||||||
<label for="hid-connect-checkbox"><span class="switch-inner"></span><span class="switch"></span></label>
|
<label for="hid-connect-switch"><span class="switch-inner"></span><span class="switch"></span></label>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</table>
|
</table>
|
||||||
@ -404,8 +404,8 @@
|
|||||||
<td>Infinite loop playback:</td>
|
<td>Infinite loop playback:</td>
|
||||||
<td align="right">
|
<td align="right">
|
||||||
<div class="switch-box">
|
<div class="switch-box">
|
||||||
<input disabled type="checkbox" id="hid-recorder-loop-checkbox">
|
<input disabled type="checkbox" id="hid-recorder-loop-switch">
|
||||||
<label for="hid-recorder-loop-checkbox"><span class="switch-inner"></span><span class="switch"></span></label>
|
<label for="hid-recorder-loop-switch"><span class="switch-inner"></span><span class="switch"></span></label>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</table>
|
</table>
|
||||||
|
|||||||
@ -22,7 +22,7 @@ li(class="right")
|
|||||||
td(id="hid-recorder-events-count" class="value") 0
|
td(id="hid-recorder-events-count" class="value") 0
|
||||||
td #[sup #[i include delays]]
|
td #[sup #[i include delays]]
|
||||||
hr
|
hr
|
||||||
+menu_switch("hid-recorder-loop-checkbox", "Infinite loop playback", false, false)
|
+menu_switch("hid-recorder-loop-switch", "Infinite loop playback", false, false)
|
||||||
hr
|
hr
|
||||||
input(type="file" id="hid-recorder-new-script-file")
|
input(type="file" id="hid-recorder-new-script-file")
|
||||||
div(class="buttons buttons-row")
|
div(class="buttons buttons-row")
|
||||||
|
|||||||
@ -27,7 +27,7 @@ li(class="right")
|
|||||||
td #[input(type="range" id="stream-size-slider" class="slider")]
|
td #[input(type="range" id="stream-size-slider" class="slider")]
|
||||||
td(id="stream-size-value" class="value" style="width: 4em") 100%
|
td(id="stream-size-value" class="value" style="width: 4em") 100%
|
||||||
hr
|
hr
|
||||||
+menu_switch("stream-auto-resize-checkbox", "Auto-resize stream window", true, true)
|
+menu_switch("stream-auto-resize-switch", "Auto-resize stream window", true, true)
|
||||||
hr
|
hr
|
||||||
div(class="buttons buttons-row")
|
div(class="buttons buttons-row")
|
||||||
button(data-force-hide-menu id="show-stream-button" class="row33") • Show stream
|
button(data-force-hide-menu id="show-stream-button" class="row33") • Show stream
|
||||||
@ -44,10 +44,10 @@ li(class="right")
|
|||||||
td #[div(id="hid-outputs-mouse" class="radio-box")]
|
td #[div(id="hid-outputs-mouse" class="radio-box")]
|
||||||
div(id="hid-mouse-squash" class="feature-disabled")
|
div(id="hid-mouse-squash" class="feature-disabled")
|
||||||
hr
|
hr
|
||||||
+menu_switch("hid-mouse-squash-checkbox", "Squash relative mouse moves", true, true)
|
+menu_switch("hid-mouse-squash-switch", "Squash relative mouse moves", true, true)
|
||||||
div(id="hid-connect" class="feature-disabled")
|
div(id="hid-connect" class="feature-disabled")
|
||||||
hr
|
hr
|
||||||
+menu_switch("hid-connect-checkbox", "Connect HID to Server", true, true)
|
+menu_switch("hid-connect-switch", "Connect HID to Server", true, true)
|
||||||
hr
|
hr
|
||||||
div(class="buttons buttons-row")
|
div(class="buttons buttons-row")
|
||||||
button(data-force-hide-menu id="show-keyboard-button" class="row50") • Show keyboard
|
button(data-force-hide-menu id="show-keyboard-button" class="row50") • Show keyboard
|
||||||
|
|||||||
@ -59,7 +59,7 @@ export function Atx() {
|
|||||||
$("atx-hdd-led").className = "led-gray";
|
$("atx-hdd-led").className = "led-gray";
|
||||||
}
|
}
|
||||||
for (let id of ["atx-power-button", "atx-power-button-long", "atx-reset-button"]) {
|
for (let id of ["atx-power-button", "atx-power-button-long", "atx-reset-button"]) {
|
||||||
wm.switchEnabled($(id), buttons_enabled);
|
wm.setElementEnabled($(id), buttons_enabled);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -48,7 +48,7 @@ export function Gpio() {
|
|||||||
for (let type of ["switch", "button"]) {
|
for (let type of ["switch", "button"]) {
|
||||||
let el = $(`gpio-${type}-${channel}`);
|
let el = $(`gpio-${type}-${channel}`);
|
||||||
if (el) {
|
if (el) {
|
||||||
wm.switchEnabled(el, state.outputs[channel].online && !state.outputs[channel].busy);
|
wm.setElementEnabled(el, state.outputs[channel].online && !state.outputs[channel].busy);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let el = $(`gpio-switch-${channel}`);
|
let el = $(`gpio-switch-${channel}`);
|
||||||
@ -62,7 +62,7 @@ export function Gpio() {
|
|||||||
}
|
}
|
||||||
for (let selector of [".gpio-switch", ".gpio-button"]) {
|
for (let selector of [".gpio-switch", ".gpio-button"]) {
|
||||||
for (let el of $$$(selector)) {
|
for (let el of $$$(selector)) {
|
||||||
wm.switchEnabled(el, false);
|
wm.setElementEnabled(el, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -75,7 +75,7 @@ export function Hid() {
|
|||||||
window.addEventListener("blur", __releaseAll);
|
window.addEventListener("blur", __releaseAll);
|
||||||
|
|
||||||
tools.setOnClick($("hid-pak-button"), __clickPasteAsKeysButton);
|
tools.setOnClick($("hid-pak-button"), __clickPasteAsKeysButton);
|
||||||
tools.setOnClick($("hid-connect-checkbox"), __clickConnectCheckbox);
|
tools.setOnClick($("hid-connect-switch"), __clickConnectSwitch);
|
||||||
tools.setOnClick($("hid-reset-button"), __clickResetButton);
|
tools.setOnClick($("hid-reset-button"), __clickResetButton);
|
||||||
|
|
||||||
for (let el_shortcut of $$$("[data-shortcut]")) {
|
for (let el_shortcut of $$$("[data-shortcut]")) {
|
||||||
@ -86,9 +86,9 @@ export function Hid() {
|
|||||||
/************************************************************************/
|
/************************************************************************/
|
||||||
|
|
||||||
self.setSocket = function(ws) {
|
self.setSocket = function(ws) {
|
||||||
wm.switchEnabled($("hid-pak-text"), ws);
|
wm.setElementEnabled($("hid-pak-text"), ws);
|
||||||
wm.switchEnabled($("hid-pak-button"), ws);
|
wm.setElementEnabled($("hid-pak-button"), ws);
|
||||||
wm.switchEnabled($("hid-reset-button"), ws);
|
wm.setElementEnabled($("hid-reset-button"), ws);
|
||||||
if (!ws) {
|
if (!ws) {
|
||||||
self.setState(null);
|
self.setState(null);
|
||||||
}
|
}
|
||||||
@ -148,13 +148,13 @@ export function Hid() {
|
|||||||
tools.featureSetEnabled($("hid-outputs"), has_outputs);
|
tools.featureSetEnabled($("hid-outputs"), has_outputs);
|
||||||
tools.featureSetEnabled($("hid-mouse-squash"), has_relative);
|
tools.featureSetEnabled($("hid-mouse-squash"), has_relative);
|
||||||
tools.featureSetEnabled($("hid-connect"), (state.connected !== null));
|
tools.featureSetEnabled($("hid-connect"), (state.connected !== null));
|
||||||
$("hid-connect-checkbox").checked = !!state.connected;
|
$("hid-connect-switch").checked = !!state.connected;
|
||||||
}
|
}
|
||||||
|
|
||||||
wm.switchRadioEnabled("hid-outputs-keyboard-radio", (state && state.online && !state.busy));
|
wm.setRadioEnabled("hid-outputs-keyboard-radio", (state && state.online && !state.busy));
|
||||||
wm.switchRadioEnabled("hid-outputs-mouse-radio", (state && state.online && !state.busy));
|
wm.setRadioEnabled("hid-outputs-mouse-radio", (state && state.online && !state.busy));
|
||||||
wm.switchEnabled($("hid-mouse-squash-checkbox"), (has_relative_squash && !state.busy));
|
wm.setElementEnabled($("hid-mouse-squash-switch"), (has_relative_squash && !state.busy));
|
||||||
wm.switchEnabled($("hid-connect-checkbox"), (state && state.online && !state.busy));
|
wm.setElementEnabled($("hid-connect-switch"), (state && state.online && !state.busy));
|
||||||
|
|
||||||
if (state) {
|
if (state) {
|
||||||
__keyboard.setState(state.keyboard, state.online, state.busy);
|
__keyboard.setState(state.keyboard, state.online, state.busy);
|
||||||
@ -203,15 +203,15 @@ export function Hid() {
|
|||||||
|
|
||||||
wm.confirm(confirm_msg).then(function(ok) {
|
wm.confirm(confirm_msg).then(function(ok) {
|
||||||
if (ok) {
|
if (ok) {
|
||||||
wm.switchEnabled($("hid-pak-text"), false);
|
wm.setElementEnabled($("hid-pak-text"), false);
|
||||||
wm.switchEnabled($("hid-pak-button"), false);
|
wm.setElementEnabled($("hid-pak-button"), false);
|
||||||
|
|
||||||
tools.debug("HID: paste-as-keys:", text);
|
tools.debug("HID: paste-as-keys:", text);
|
||||||
|
|
||||||
let http = tools.makeRequest("POST", "/api/hid/print?limit=0", function() {
|
let http = tools.makeRequest("POST", "/api/hid/print?limit=0", function() {
|
||||||
if (http.readyState === 4) {
|
if (http.readyState === 4) {
|
||||||
wm.switchEnabled($("hid-pak-text"), true);
|
wm.setElementEnabled($("hid-pak-text"), true);
|
||||||
wm.switchEnabled($("hid-pak-button"), true);
|
wm.setElementEnabled($("hid-pak-button"), true);
|
||||||
$("hid-pak-text").value = "";
|
$("hid-pak-text").value = "";
|
||||||
if (http.status === 413) {
|
if (http.status === 413) {
|
||||||
wm.error("Too many text for paste!");
|
wm.error("Too many text for paste!");
|
||||||
@ -240,8 +240,8 @@ export function Hid() {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
var __clickConnectCheckbox = function() {
|
var __clickConnectSwitch = function() {
|
||||||
let connected = $("hid-connect-checkbox").checked;
|
let connected = $("hid-connect-switch").checked;
|
||||||
let http = tools.makeRequest("POST", `/api/hid/set_connected?connected=${connected}`, function() {
|
let http = tools.makeRequest("POST", `/api/hid/set_connected?connected=${connected}`, function() {
|
||||||
if (http.readyState === 4) {
|
if (http.readyState === 4) {
|
||||||
if (http.status !== 200) {
|
if (http.status !== 200) {
|
||||||
|
|||||||
@ -141,7 +141,7 @@ export function Mouse(record_callback) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
var __isRelativeSquashed = function() {
|
var __isRelativeSquashed = function() {
|
||||||
return $("hid-mouse-squash-checkbox").checked;
|
return $("hid-mouse-squash-switch").checked;
|
||||||
};
|
};
|
||||||
|
|
||||||
var __relativeCapturedHandler = function() {
|
var __relativeCapturedHandler = function() {
|
||||||
|
|||||||
@ -64,8 +64,8 @@ export function Msd() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
var __selectImage = function() {
|
var __selectImage = function() {
|
||||||
wm.switchEnabled($("msd-image-selector"), false);
|
wm.setElementEnabled($("msd-image-selector"), false);
|
||||||
wm.switchEnabled($("msd-remove-image"), false);
|
wm.setElementEnabled($("msd-remove-image"), false);
|
||||||
__sendParam("image", $("msd-image-selector").value);
|
__sendParam("image", $("msd-image-selector").value);
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -148,7 +148,7 @@ export function Msd() {
|
|||||||
__applyState();
|
__applyState();
|
||||||
});
|
});
|
||||||
__applyState();
|
__applyState();
|
||||||
wm.switchEnabled($(`msd-${connected ? "connect" : "disconnect"}-button`), false);
|
wm.setElementEnabled($(`msd-${connected ? "connect" : "disconnect"}-button`), false);
|
||||||
};
|
};
|
||||||
|
|
||||||
var __selectNewImageFile = function() {
|
var __selectNewImageFile = function() {
|
||||||
@ -217,23 +217,23 @@ export function Msd() {
|
|||||||
tools.progressSetValue($("msd-storage-progress"), "Storage: unavailable", 0);
|
tools.progressSetValue($("msd-storage-progress"), "Storage: unavailable", 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
wm.switchEnabled($("msd-image-selector"), (__state.online && __state.features.multi && !__state.drive.connected && !__state.busy));
|
wm.setElementEnabled($("msd-image-selector"), (__state.online && __state.features.multi && !__state.drive.connected && !__state.busy));
|
||||||
if (__state.features.multi && !__state.storage.uploading) {
|
if (__state.features.multi && !__state.storage.uploading) {
|
||||||
__refreshImageSelector();
|
__refreshImageSelector();
|
||||||
}
|
}
|
||||||
wm.switchEnabled($("msd-remove-image"), (__state.online && __state.features.multi && __state.drive.image && !__state.drive.connected && !__state.busy));
|
wm.setElementEnabled($("msd-remove-image"), (__state.online && __state.features.multi && __state.drive.image && !__state.drive.connected && !__state.busy));
|
||||||
|
|
||||||
wm.switchRadioEnabled("msd-mode-radio", (__state.online && __state.features.cdrom && !__state.drive.connected && !__state.busy));
|
wm.setRadioEnabled("msd-mode-radio", (__state.online && __state.features.cdrom && !__state.drive.connected && !__state.busy));
|
||||||
tools.radioSetValue("msd-mode-radio", `${Number(__state.online && __state.features.cdrom && __state.drive.cdrom)}`);
|
tools.radioSetValue("msd-mode-radio", `${Number(__state.online && __state.features.cdrom && __state.drive.cdrom)}`);
|
||||||
|
|
||||||
wm.switchEnabled($("msd-connect-button"), (__state.online && (!__state.features.multi || __state.drive.image) && !__state.drive.connected && !__state.busy));
|
wm.setElementEnabled($("msd-connect-button"), (__state.online && (!__state.features.multi || __state.drive.image) && !__state.drive.connected && !__state.busy));
|
||||||
wm.switchEnabled($("msd-disconnect-button"), (__state.online && __state.drive.connected && !__state.busy));
|
wm.setElementEnabled($("msd-disconnect-button"), (__state.online && __state.drive.connected && !__state.busy));
|
||||||
|
|
||||||
wm.switchEnabled($("msd-select-new-image-button"), (__state.online && !__state.drive.connected && !__upload_http && !__state.busy));
|
wm.setElementEnabled($("msd-select-new-image-button"), (__state.online && !__state.drive.connected && !__upload_http && !__state.busy));
|
||||||
wm.switchEnabled($("msd-upload-new-image-button"), (__state.online && !__state.drive.connected && __image_file && !__state.busy));
|
wm.setElementEnabled($("msd-upload-new-image-button"), (__state.online && !__state.drive.connected && __image_file && !__state.busy));
|
||||||
wm.switchEnabled($("msd-abort-uploading-button"), (__state.online && __upload_http));
|
wm.setElementEnabled($("msd-abort-uploading-button"), (__state.online && __upload_http));
|
||||||
|
|
||||||
wm.switchEnabled($("msd-reset-button"), (__state.enabled && !__state.busy));
|
wm.setElementEnabled($("msd-reset-button"), (__state.enabled && !__state.busy));
|
||||||
|
|
||||||
tools.hiddenSetVisible($("msd-submenu-new-image"), __image_file);
|
tools.hiddenSetVisible($("msd-submenu-new-image"), __image_file);
|
||||||
$("msd-new-image-name").innerHTML = (__image_file ? __image_file.name : "");
|
$("msd-new-image-name").innerHTML = (__image_file ? __image_file.name : "");
|
||||||
@ -256,21 +256,21 @@ export function Msd() {
|
|||||||
$("msd-storage-size").innerHTML = "";
|
$("msd-storage-size").innerHTML = "";
|
||||||
tools.progressSetValue($("msd-storage-progress"), "", 0);
|
tools.progressSetValue($("msd-storage-progress"), "", 0);
|
||||||
|
|
||||||
wm.switchEnabled($("msd-image-selector"), false);
|
wm.setElementEnabled($("msd-image-selector"), false);
|
||||||
$("msd-image-selector").options.length = 1;
|
$("msd-image-selector").options.length = 1;
|
||||||
wm.switchEnabled($("msd-remove-image"), false);
|
wm.setElementEnabled($("msd-remove-image"), false);
|
||||||
|
|
||||||
wm.switchRadioEnabled("msd-mode-radio", false);
|
wm.setRadioEnabled("msd-mode-radio", false);
|
||||||
tools.radioSetValue("msd-mode-radio", "0");
|
tools.radioSetValue("msd-mode-radio", "0");
|
||||||
|
|
||||||
wm.switchEnabled($("msd-connect-button"), false);
|
wm.setElementEnabled($("msd-connect-button"), false);
|
||||||
wm.switchEnabled($("msd-disconnect-button"), false);
|
wm.setElementEnabled($("msd-disconnect-button"), false);
|
||||||
|
|
||||||
wm.switchEnabled($("msd-select-new-image-button"), false);
|
wm.setElementEnabled($("msd-select-new-image-button"), false);
|
||||||
wm.switchEnabled($("msd-upload-new-image-button"), false);
|
wm.setElementEnabled($("msd-upload-new-image-button"), false);
|
||||||
wm.switchEnabled($("msd-abort-uploading-button"), false);
|
wm.setElementEnabled($("msd-abort-uploading-button"), false);
|
||||||
|
|
||||||
wm.switchEnabled($("msd-reset-button"), false);
|
wm.setElementEnabled($("msd-reset-button"), false);
|
||||||
|
|
||||||
$("msd-select-new-image-file").value = "";
|
$("msd-select-new-image-file").value = "";
|
||||||
tools.hiddenSetVisible($("msd-submenu-new-image"), false);
|
tools.hiddenSetVisible($("msd-submenu-new-image"), false);
|
||||||
|
|||||||
@ -222,7 +222,7 @@ export function Recorder() {
|
|||||||
}
|
}
|
||||||
index += 1;
|
index += 1;
|
||||||
}
|
}
|
||||||
if ($("hid-recorder-loop-checkbox").checked) {
|
if ($("hid-recorder-loop-switch").checked) {
|
||||||
setTimeout(() => __runEvents(0));
|
setTimeout(() => __runEvents(0));
|
||||||
} else {
|
} else {
|
||||||
__stopProcess();
|
__stopProcess();
|
||||||
@ -241,14 +241,14 @@ export function Recorder() {
|
|||||||
$("hid-recorder-led").title = "";
|
$("hid-recorder-led").title = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
wm.switchEnabled($("hid-recorder-record"), (__ws && !__play_timer && !__recording));
|
wm.setElementEnabled($("hid-recorder-record"), (__ws && !__play_timer && !__recording));
|
||||||
wm.switchEnabled($("hid-recorder-stop"), (__ws && (__play_timer || __recording)));
|
wm.setElementEnabled($("hid-recorder-stop"), (__ws && (__play_timer || __recording)));
|
||||||
wm.switchEnabled($("hid-recorder-play"), (__ws && !__recording && __events.length));
|
wm.setElementEnabled($("hid-recorder-play"), (__ws && !__recording && __events.length));
|
||||||
wm.switchEnabled($("hid-recorder-clear"), (!__play_timer && !__recording && __events.length));
|
wm.setElementEnabled($("hid-recorder-clear"), (!__play_timer && !__recording && __events.length));
|
||||||
wm.switchEnabled($("hid-recorder-loop-checkbox"), (__ws && !__recording));
|
wm.setElementEnabled($("hid-recorder-loop-switch"), (__ws && !__recording));
|
||||||
|
|
||||||
wm.switchEnabled($("hid-recorder-upload"), (!__play_timer && !__recording));
|
wm.setElementEnabled($("hid-recorder-upload"), (!__play_timer && !__recording));
|
||||||
wm.switchEnabled($("hid-recorder-download"), (!__play_timer && !__recording && __events.length));
|
wm.setElementEnabled($("hid-recorder-download"), (!__play_timer && !__recording && __events.length));
|
||||||
|
|
||||||
__setCounters(__events.length, __events_time);
|
__setCounters(__events.length, __events_time);
|
||||||
};
|
};
|
||||||
|
|||||||
@ -90,7 +90,7 @@ export function Streamer() {
|
|||||||
|
|
||||||
if (state && state.streamer) {
|
if (state && state.streamer) {
|
||||||
if (!$("stream-quality-slider").activated) {
|
if (!$("stream-quality-slider").activated) {
|
||||||
wm.switchEnabled($("stream-quality-slider"), true);
|
wm.setElementEnabled($("stream-quality-slider"), true);
|
||||||
if ($("stream-quality-slider").value !== state.streamer.encoder.quality) {
|
if ($("stream-quality-slider").value !== state.streamer.encoder.quality) {
|
||||||
$("stream-quality-slider").value = state.streamer.encoder.quality;
|
$("stream-quality-slider").value = state.streamer.encoder.quality;
|
||||||
__updateQualityValue(state.streamer.encoder.quality);
|
__updateQualityValue(state.streamer.encoder.quality);
|
||||||
@ -99,7 +99,7 @@ export function Streamer() {
|
|||||||
|
|
||||||
if (!$("stream-desired-fps-slider").activated) {
|
if (!$("stream-desired-fps-slider").activated) {
|
||||||
$("stream-desired-fps-slider").max = state.limits.max_fps;
|
$("stream-desired-fps-slider").max = state.limits.max_fps;
|
||||||
wm.switchEnabled($("stream-desired-fps-slider"), true);
|
wm.setElementEnabled($("stream-desired-fps-slider"), true);
|
||||||
if ($("stream-desired-fps-slider").value !== state.streamer.source.desired_fps) {
|
if ($("stream-desired-fps-slider").value !== state.streamer.source.desired_fps) {
|
||||||
$("stream-desired-fps-slider").value = state.streamer.source.desired_fps;
|
$("stream-desired-fps-slider").value = state.streamer.source.desired_fps;
|
||||||
__updateDesiredFpsValue(state.streamer.source.desired_fps);
|
__updateDesiredFpsValue(state.streamer.source.desired_fps);
|
||||||
@ -112,7 +112,7 @@ export function Streamer() {
|
|||||||
) {
|
) {
|
||||||
__resolution = state.streamer.source.resolution;
|
__resolution = state.streamer.source.resolution;
|
||||||
__resolution_str = `${__resolution.width}x${__resolution.height}`;
|
__resolution_str = `${__resolution.width}x${__resolution.height}`;
|
||||||
if ($("stream-auto-resize-checkbox").checked) {
|
if ($("stream-auto-resize-switch").checked) {
|
||||||
__adjustSizeFactor();
|
__adjustSizeFactor();
|
||||||
} else {
|
} else {
|
||||||
__applySizeFactor();
|
__applySizeFactor();
|
||||||
@ -132,14 +132,14 @@ export function Streamer() {
|
|||||||
$("stream-resolution-selector").resolutions = state.limits.available_resolutions;
|
$("stream-resolution-selector").resolutions = state.limits.available_resolutions;
|
||||||
}
|
}
|
||||||
document.querySelector(`#stream-resolution-selector [value="${__resolution_str}"]`).selected = true;
|
document.querySelector(`#stream-resolution-selector [value="${__resolution_str}"]`).selected = true;
|
||||||
wm.switchEnabled($("stream-resolution-selector"), true);
|
wm.setElementEnabled($("stream-resolution-selector"), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (__ensureStream(state.streamer.stream.clients_stat)) {
|
if (__ensureStream(state.streamer.stream.clients_stat)) {
|
||||||
$("stream-led").className = "led-green";
|
$("stream-led").className = "led-green";
|
||||||
$("stream-led").title = "Stream is active";
|
$("stream-led").title = "Stream is active";
|
||||||
wm.switchEnabled($("stream-screenshot-button"), true);
|
wm.setElementEnabled($("stream-screenshot-button"), true);
|
||||||
wm.switchEnabled($("stream-reset-button"), true);
|
wm.setElementEnabled($("stream-reset-button"), true);
|
||||||
$("stream-quality-slider").activated = false;
|
$("stream-quality-slider").activated = false;
|
||||||
$("stream-desired-fps-slider").activated = false;
|
$("stream-desired-fps-slider").activated = false;
|
||||||
|
|
||||||
@ -155,11 +155,11 @@ export function Streamer() {
|
|||||||
|
|
||||||
$("stream-led").className = "led-gray";
|
$("stream-led").className = "led-gray";
|
||||||
$("stream-led").title = "Stream inactive";
|
$("stream-led").title = "Stream inactive";
|
||||||
wm.switchEnabled($("stream-screenshot-button"), false);
|
wm.setElementEnabled($("stream-screenshot-button"), false);
|
||||||
wm.switchEnabled($("stream-reset-button"), false);
|
wm.setElementEnabled($("stream-reset-button"), false);
|
||||||
wm.switchEnabled($("stream-quality-slider"), false);
|
wm.setElementEnabled($("stream-quality-slider"), false);
|
||||||
wm.switchEnabled($("stream-desired-fps-slider"), false);
|
wm.setElementEnabled($("stream-desired-fps-slider"), false);
|
||||||
wm.switchEnabled($("stream-resolution-selector"), false);
|
wm.setElementEnabled($("stream-resolution-selector"), false);
|
||||||
|
|
||||||
__updateStreamWindow(false, false);
|
__updateStreamWindow(false, false);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -45,7 +45,7 @@ export function WakeOnLan() {
|
|||||||
tools.featureSetEnabled($("wol"), state.enabled);
|
tools.featureSetEnabled($("wol"), state.enabled);
|
||||||
__target = state.target;
|
__target = state.target;
|
||||||
}
|
}
|
||||||
wm.switchEnabled($("wol-wakeup-button"), (state && state.enabled));
|
wm.setElementEnabled($("wol-wakeup-button"), (state && state.enabled));
|
||||||
};
|
};
|
||||||
|
|
||||||
var __clickWakeupButton = function() {
|
var __clickWakeupButton = function() {
|
||||||
|
|||||||
@ -75,9 +75,9 @@ function __login() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function __setEnabled(enabled) {
|
function __setEnabled(enabled) {
|
||||||
wm.switchEnabled($("user-input"), enabled);
|
wm.setElementEnabled($("user-input"), enabled);
|
||||||
wm.switchEnabled($("passwd-input"), enabled);
|
wm.setElementEnabled($("passwd-input"), enabled);
|
||||||
wm.switchEnabled($("login-button"), enabled);
|
wm.setElementEnabled($("login-button"), enabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
function __tryAgain() {
|
function __tryAgain() {
|
||||||
|
|||||||
@ -162,7 +162,7 @@ function __WindowManager() {
|
|||||||
return promise;
|
return promise;
|
||||||
};
|
};
|
||||||
|
|
||||||
self.switchEnabled = function(el, enabled) {
|
self.setElementEnabled = function(el, enabled) {
|
||||||
if (!enabled && document.activeElement === el) {
|
if (!enabled && document.activeElement === el) {
|
||||||
let el_to_focus = (
|
let el_to_focus = (
|
||||||
el.closest(".modal-window")
|
el.closest(".modal-window")
|
||||||
@ -176,9 +176,9 @@ function __WindowManager() {
|
|||||||
el.disabled = !enabled;
|
el.disabled = !enabled;
|
||||||
};
|
};
|
||||||
|
|
||||||
self.switchRadioEnabled = function(name, enabled) {
|
self.setRadioEnabled = function(name, enabled) {
|
||||||
for (let el of $$$(`input[type="radio"][name="${name}"]`)) {
|
for (let el of $$$(`input[type="radio"][name="${name}"]`)) {
|
||||||
self.switchEnabled(el, enabled);
|
self.setElementEnabled(el, enabled);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user