refactoring

This commit is contained in:
Devaev Maxim
2021-07-14 16:34:28 +03:00
parent c903f60f85
commit c19c02d12f
2 changed files with 3 additions and 4 deletions

View File

@@ -438,7 +438,7 @@ export function Streamer() {
$("stream-resolution-selector").onchange = (() => __sendParam("resolution", $("stream-resolution-selector").value)); $("stream-resolution-selector").onchange = (() => __sendParam("resolution", $("stream-resolution-selector").value));
tools.radioSetOnClick("stream-mode-radio", __clickModeRadio); tools.radioSetOnClick("stream-mode-radio", __clickModeRadio, false);
tools.setOnClick($("stream-screenshot-button"), __clickScreenshotButton); tools.setOnClick($("stream-screenshot-button"), __clickScreenshotButton);
tools.setOnClick($("stream-reset-button"), __clickResetButton); tools.setOnClick($("stream-reset-button"), __clickResetButton);
@@ -612,7 +612,6 @@ export function Streamer() {
let mode = tools.radioGetValue("stream-mode-radio"); let mode = tools.radioGetValue("stream-mode-radio");
tools.storage.set("stream.mode", mode); tools.storage.set("stream.mode", mode);
if (mode !== __streamer.getMode()) { if (mode !== __streamer.getMode()) {
setTimeout(() => tools.radioSetValue("stream-mode-radio", mode), 100);
tools.hiddenSetVisible($("stream-image"), (mode !== "janus")); tools.hiddenSetVisible($("stream-image"), (mode !== "janus"));
tools.hiddenSetVisible($("stream-video"), (mode === "janus")); tools.hiddenSetVisible($("stream-video"), (mode === "janus"));
if (mode === "janus") { if (mode === "janus") {

View File

@@ -153,9 +153,9 @@ export var tools = new function() {
<label for="${name}-${value}">${title}</label> <label for="${name}-${value}">${title}</label>
`; `;
}; };
this.radioSetOnClick = function(name, callback) { this.radioSetOnClick = function(name, callback, prevent_default=true) {
for (let el of $$$(`input[type="radio"][name="${name}"]`)) { for (let el of $$$(`input[type="radio"][name="${name}"]`)) {
this.setOnClick(el, callback); this.setOnClick(el, callback, prevent_default);
} }
}; };
this.radioGetValue = function(name) { this.radioGetValue = function(name) {