1 parent
1ae36c9aff
commit
cf7f72e240
2 files changed
+21
-5
No files matched your search
@@ -75,7 +75,26 @@ $(function () {
|
||||
}
|
||||
};
|
||||
|
||||
const selectedCameraStorageKey = "core.control.selectedCamera";
|
||||
self.selectDefaultWebcam = function () {
|
||||
let div = localStorage[selectedCameraStorageKey];
|
||||
|
||||
if (!div || document.getElementById(div.slice(1)) === null) {
|
||||
div = undefined;
|
||||
}
|
||||
|
||||
if (div !== undefined) {
|
||||
$(`${div}_link a`).tab("show");
|
||||
} else {
|
||||
$("#webcam_plugins_container .nav li:first a").tab("show");
|
||||
}
|
||||
};
|
||||
|
||||
self.onStartupComplete = function () {
|
||||
$("#webcam_plugins_container .nav a[data-toggle='tab']").on("shown", (e) => {
|
||||
localStorage[selectedCameraStorageKey] = e.target.hash;
|
||||
});
|
||||
self.selectDefaultWebcam();
|
||||
self.recreateIntersectionObservers();
|
||||
};
|
||||
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
{% if enableWebcam %}
|
||||
<div id="webcam_plugins_container" tabindex="0" data-bind="visible: loginState.hasPermissionKo(access.permissions.WEBCAM), event: { keydown: onKeyDown, mouseover: onMouseOver, mouseout: onMouseOut, focus: onFocus }">
|
||||
<div class="tabbable row-fluid">
|
||||
{% set nsContent = namespace(mark_active = True) %}
|
||||
{% set nsTab = namespace(mark_active = True) %}
|
||||
|
||||
<div class="tab-content" id="webcam-group">
|
||||
{% for key in templates.webcam.order %}
|
||||
{% set entry, data = templates.webcam.entries[key] %}
|
||||
@@ -11,7 +8,7 @@
|
||||
{% if "custom_bindings" not in data or data["custom_bindings"] %}<!-- ko allowBindings: false -->{% endif %}
|
||||
<div id="{{ data._div }}"
|
||||
{% if "data_bind" in data %}data-bind="{{ data.data_bind }}"{% endif %}
|
||||
class="tab-pane {% if nsContent.mark_active %}active{% set nsContent.mark_active = False %}{% endif %} {% if classes_content in data %}{{ data.classes_content|join(' ') }}{% elif classes in data %}{{ data.classes|join(' ') }}{% endif %}"
|
||||
class="tab-pane {% if classes_content in data %}{{ data.classes_content|join(' ') }}{% elif classes in data %}{{ data.classes|join(' ') }}{% endif %}"
|
||||
{% if "styles_content" in data %} style="{{ data.styles_content|join(', ') }}" {% elif styles in data %} style="{{ data.styles|join(', ') }}" {% endif %}
|
||||
>
|
||||
{% try "There was an error with the template {filename} at line number {lineno}: {exception}" %}{% include data.template ignore missing %}{% endtry %}
|
||||
@@ -29,7 +26,7 @@
|
||||
{% set entry, data = templates.webcam.entries[key] %}
|
||||
<li id="{{ data._div }}_link"
|
||||
{% if "data_bind" in data %}data-bind="{{ data.data_bind }}"{% endif %}
|
||||
class="nav-item {% if nsTab.mark_active %}active{% set nsTab.mark_active = False %}{% endif %}">
|
||||
class="nav-item">
|
||||
<a class="nav-link" href="#{{ data._div }}" data-toggle="tab">{{ entry|e }}</a>
|
||||
</li>
|
||||
{% endfor %}
|
||||
|
||||
Reference in new issue
Block a user