diff --git a/public/js/smarthome.js b/public/js/smarthome.js index 351e1ef9..964340cf 100644 --- a/public/js/smarthome.js +++ b/public/js/smarthome.js @@ -149,6 +149,15 @@ } catch (_) { /* leer lassen */ } } + // Modal open/close wired in JS (CSP blocks inline onclick: script-src-attr 'none'). + function wireModal() { + const modal = $('#sh-connect-modal'); + const open = $('#sh-connect-open'); + if (open && modal) open.addEventListener('click', () => { modal.style.display = 'flex'; }); + document.querySelectorAll('[data-sh-close]').forEach((el) => + el.addEventListener('click', () => { if (modal) modal.style.display = 'none'; })); + } + function wireConnect() { const btn = $('#sh-c-submit'); if (!btn) return; btn.addEventListener('click', async () => { @@ -191,6 +200,6 @@ }); } - document.addEventListener('DOMContentLoaded', () => { fillRoutes(); wireConnect(); wireTest(); loadGateways(); }); + document.addEventListener('DOMContentLoaded', () => { wireModal(); fillRoutes(); wireConnect(); wireTest(); loadGateways(); }); window.SmartHome = { loadGateways, loadResources, api }; })(); diff --git a/templates/aurora/layout.njk b/templates/aurora/layout.njk index c5a842f9..30dce19e 100644 --- a/templates/aurora/layout.njk +++ b/templates/aurora/layout.njk @@ -54,6 +54,19 @@ midea_integration: {{ ('true' if license.features.midea_integration else 'false') | safe }} }, t: { + 'smarthome.power': {{ t('smarthome.power') | dump | safe }}, + 'smarthome.brightness': {{ t('smarthome.brightness') | dump | safe }}, + 'smarthome.color': {{ t('smarthome.color') | dump | safe }}, + 'smarthome.warmth': {{ t('smarthome.warmth') | dump | safe }}, + 'smarthome.activate': {{ t('smarthome.activate') | dump | safe }}, + 'smarthome.load_error': {{ t('smarthome.load_error') | dump | safe }}, + 'smarthome.empty': {{ t('smarthome.empty') | dump | safe }}, + 'smarthome.section.lights': {{ t('smarthome.section.lights') | dump | safe }}, + 'smarthome.section.groups': {{ t('smarthome.section.groups') | dump | safe }}, + 'smarthome.section.sensors': {{ t('smarthome.section.sensors') | dump | safe }}, + 'smarthome.kpi.groups': {{ t('smarthome.kpi.groups') | dump | safe }}, + 'smarthome.test_ok': {{ t('smarthome.test_ok') | dump | safe }}, + 'smarthome.test_fail': {{ t('smarthome.test_fail') | dump | safe }}, 'peers.no_peers': {{ t('peers.no_peers') | dump | safe }}, 'peers.online': {{ t('peers.online') | dump | safe }}, 'peers.offline': {{ t('peers.offline') | dump | safe }}, diff --git a/templates/aurora/pages/smarthome.njk b/templates/aurora/pages/smarthome.njk index 355e8691..1dea4649 100644 --- a/templates/aurora/pages/smarthome.njk +++ b/templates/aurora/pages/smarthome.njk @@ -13,7 +13,7 @@ - + diff --git a/templates/aurora/partials/modals/smarthome-connect.njk b/templates/aurora/partials/modals/smarthome-connect.njk index ce496897..a5fb5cdd 100644 --- a/templates/aurora/partials/modals/smarthome-connect.njk +++ b/templates/aurora/partials/modals/smarthome-connect.njk @@ -2,7 +2,7 @@ diff --git a/templates/default/layout.njk b/templates/default/layout.njk index c76eb99d..95b4b21f 100644 --- a/templates/default/layout.njk +++ b/templates/default/layout.njk @@ -53,6 +53,19 @@ midea_integration: {{ ('true' if license.features.midea_integration else 'false') | safe }} }, t: { + 'smarthome.power': {{ t('smarthome.power') | dump | safe }}, + 'smarthome.brightness': {{ t('smarthome.brightness') | dump | safe }}, + 'smarthome.color': {{ t('smarthome.color') | dump | safe }}, + 'smarthome.warmth': {{ t('smarthome.warmth') | dump | safe }}, + 'smarthome.activate': {{ t('smarthome.activate') | dump | safe }}, + 'smarthome.load_error': {{ t('smarthome.load_error') | dump | safe }}, + 'smarthome.empty': {{ t('smarthome.empty') | dump | safe }}, + 'smarthome.section.lights': {{ t('smarthome.section.lights') | dump | safe }}, + 'smarthome.section.groups': {{ t('smarthome.section.groups') | dump | safe }}, + 'smarthome.section.sensors': {{ t('smarthome.section.sensors') | dump | safe }}, + 'smarthome.kpi.groups': {{ t('smarthome.kpi.groups') | dump | safe }}, + 'smarthome.test_ok': {{ t('smarthome.test_ok') | dump | safe }}, + 'smarthome.test_fail': {{ t('smarthome.test_fail') | dump | safe }}, 'peers.no_peers': {{ t('peers.no_peers') | dump | safe }}, 'peers.online': {{ t('peers.online') | dump | safe }}, 'peers.offline': {{ t('peers.offline') | dump | safe }}, diff --git a/templates/default/pages/smarthome.njk b/templates/default/pages/smarthome.njk index b53c39a2..31358655 100644 --- a/templates/default/pages/smarthome.njk +++ b/templates/default/pages/smarthome.njk @@ -13,7 +13,7 @@ - + diff --git a/templates/default/partials/modals/smarthome-connect.njk b/templates/default/partials/modals/smarthome-connect.njk index ce496897..a5fb5cdd 100644 --- a/templates/default/partials/modals/smarthome-connect.njk +++ b/templates/default/partials/modals/smarthome-connect.njk @@ -2,7 +2,7 @@ diff --git a/templates/pro/layout.njk b/templates/pro/layout.njk index 5855a994..7a1a2482 100644 --- a/templates/pro/layout.njk +++ b/templates/pro/layout.njk @@ -55,6 +55,19 @@ midea_integration: {{ ('true' if license.features.midea_integration else 'false') | safe }} }, t: { + 'smarthome.power': {{ t('smarthome.power') | dump | safe }}, + 'smarthome.brightness': {{ t('smarthome.brightness') | dump | safe }}, + 'smarthome.color': {{ t('smarthome.color') | dump | safe }}, + 'smarthome.warmth': {{ t('smarthome.warmth') | dump | safe }}, + 'smarthome.activate': {{ t('smarthome.activate') | dump | safe }}, + 'smarthome.load_error': {{ t('smarthome.load_error') | dump | safe }}, + 'smarthome.empty': {{ t('smarthome.empty') | dump | safe }}, + 'smarthome.section.lights': {{ t('smarthome.section.lights') | dump | safe }}, + 'smarthome.section.groups': {{ t('smarthome.section.groups') | dump | safe }}, + 'smarthome.section.sensors': {{ t('smarthome.section.sensors') | dump | safe }}, + 'smarthome.kpi.groups': {{ t('smarthome.kpi.groups') | dump | safe }}, + 'smarthome.test_ok': {{ t('smarthome.test_ok') | dump | safe }}, + 'smarthome.test_fail': {{ t('smarthome.test_fail') | dump | safe }}, 'peers.no_peers': {{ t('peers.no_peers') | dump | safe }}, 'peers.online': {{ t('peers.online') | dump | safe }}, 'peers.offline': {{ t('peers.offline') | dump | safe }}, diff --git a/templates/pro/pages/smarthome.njk b/templates/pro/pages/smarthome.njk index b53c39a2..31358655 100644 --- a/templates/pro/pages/smarthome.njk +++ b/templates/pro/pages/smarthome.njk @@ -13,7 +13,7 @@ - + diff --git a/templates/pro/partials/modals/smarthome-connect.njk b/templates/pro/partials/modals/smarthome-connect.njk index ce496897..a5fb5cdd 100644 --- a/templates/pro/partials/modals/smarthome-connect.njk +++ b/templates/pro/partials/modals/smarthome-connect.njk @@ -2,7 +2,7 @@