summaryrefslogtreecommitdiff
path: root/web/share/js/kvm/stream.js
diff options
context:
space:
mode:
authorDevaev Maxim <[email protected]>2021-04-03 10:41:07 +0300
committerDevaev Maxim <[email protected]>2021-04-03 11:01:16 +0300
commitb4b98583d47943c3e7af368c4755f9cf4b393562 (patch)
tree72771a85eda77e7dbd46e3bf3bb2ec4681e2cfdf /web/share/js/kvm/stream.js
parent26cc73ab8a1e3f95c8abeb350c3611a97f306b6d (diff)
refactoring
Diffstat (limited to 'web/share/js/kvm/stream.js')
-rw-r--r--web/share/js/kvm/stream.js20
1 files changed, 10 insertions, 10 deletions
diff --git a/web/share/js/kvm/stream.js b/web/share/js/kvm/stream.js
index 3490d046..373637ea 100644
--- a/web/share/js/kvm/stream.js
+++ b/web/share/js/kvm/stream.js
@@ -33,7 +33,6 @@ export function Streamer() {
/************************************************************************/
var __resolution = {width: 640, height: 480};
- var __resolution_str = "640x480";
var __size_factor = 1;
@@ -107,12 +106,9 @@ export function Streamer() {
}
}
- if (
- __resolution.width !== state.streamer.source.resolution.width
- || __resolution.height !== state.streamer.source.resolution.height
- ) {
+ let resolution_str = __makeStringResolution(state.streamer.source.resolution);
+ if (__makeStringResolution(__resolution) != resolution_str) {
__resolution = state.streamer.source.resolution;
- __resolution_str = `${__resolution.width}x${__resolution.height}`;
if ($("stream-auto-resize-switch").checked) {
__adjustSizeFactor();
} else {
@@ -126,13 +122,13 @@ export function Streamer() {
for (let variant of state.limits.available_resolutions) {
resolutions_html += `<option value="${variant}">${variant}</option>`;
}
- if (!state.limits.available_resolutions.includes(__resolution_str)) {
- resolutions_html += `<option value="${__resolution_str}">${__resolution_str}</option>`;
+ if (!state.limits.available_resolutions.includes(resolution_str)) {
+ resolutions_html += `<option value="${resolution_str}">${resolution_str}</option>`;
}
$("stream-resolution-selector").innerHTML = resolutions_html;
$("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.setElementEnabled($("stream-resolution-selector"), true);
}
@@ -214,7 +210,7 @@ export function Streamer() {
if (!online) {
title += "no signal / ";
}
- title += __resolution_str;
+ title += __makeStringResolution(__resolution);
if (__client_fps >= 0) {
title += ` / ${__client_fps} fps`;
}
@@ -301,5 +297,9 @@ export function Streamer() {
wm.showWindow($("stream-window"), false);
};
+ var __makeStringResolution = function(resolution) {
+ return `${resolution.width}x${resolution.height}`;
+ };
+
__init__();
}