🐛 Fix webcam view w/ one webcam only
In that case the nav container isn't available, and thus the attempt to select the first link from that to activate simply failed silently. Instead we now check whether the nav container is even there, and if not just activate the first tab pane. Closes #4791
This commit is contained in:
1 parent
6cd28614d5
commit
c1b658e374
1 file changed
+6
@@ -77,6 +77,12 @@ $(function () {
|
||||
|
||||
const selectedCameraStorageKey = "core.control.selectedCamera";
|
||||
self.selectDefaultWebcam = function () {
|
||||
if (!document.querySelector("#webcam_plugins_container .nav")) {
|
||||
// we only have one webcam plugin, select that and be done (note: this bypasses local storage)
|
||||
$("#webcam-group .tab-pane:first").addClass("active");
|
||||
return;
|
||||
}
|
||||
|
||||
let div = localStorage[selectedCameraStorageKey];
|
||||
|
||||
if (!div || document.getElementById(div.slice(1)) === null) {
|
||||
|
||||
Reference in new issue
Block a user