wire webui region coordinate edit toggle

This commit is contained in:
Your Name committed 2026-06-05 15:45:20 +08:00
1 parent 9b03556b7d
commit e3bf99149d
2 files changed
+15 -1

No files matched your search

+14
View File
@@ -25,6 +25,19 @@ function syncMirrorFields() {
}
}
function syncRegionCoordEditability() {
const toggle = document.querySelector('#region_coords_edit_enabled');
if (!toggle) return;
const apply = () => {
const enabled = !!toggle.checked;
document.querySelectorAll('[data-index]').forEach((el) => {
el.disabled = !enabled;
});
};
apply();
toggle.addEventListener('change', apply);
}
function getConfigValue(cfg, key) {
if (!cfg || !key) return undefined;
if (Object.prototype.hasOwnProperty.call(cfg, key)) return cfg[key];
@@ -128,6 +141,7 @@ async function loadConfig() {
try {
const cfg = await apiGet("/api/config");
applyConfigToUI(cfg);
syncRegionCoordEditability();
toast("配置已加载", "success");
} catch (e) {
toast("配置加载失败:" + e.message, "error", { duration: 5000 });