Spaces:
Sleeping
Sleeping
fix: null guard for removed coords-toggle element crash
Browse files- Add null check on coordsToggle.addEventListener (element removed)
- Add null guard on loadMemo for removed memo-panel
- Fixes TypeError: Cannot read properties of null at create()
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
frontend/electron-standalone.html
CHANGED
|
@@ -2377,7 +2377,7 @@
|
|
| 2377 |
async function loadMemo() {
|
| 2378 |
const memoDate = document.getElementById('memo-date');
|
| 2379 |
const memoContent = document.getElementById('memo-content');
|
| 2380 |
-
|
| 2381 |
try {
|
| 2382 |
const response = await fetch('/yesterday-memo?t=' + Date.now(), { cache: 'no-store' });
|
| 2383 |
const data = await response.json();
|
|
@@ -5212,12 +5212,14 @@ function toggleBrokerPanel() {
|
|
| 5212 |
coordsToggle = document.getElementById('coords-toggle');
|
| 5213 |
|
| 5214 |
// guest agent 将由 /agents 动态拉取并渲染到右侧访客列表
|
| 5215 |
-
|
| 5216 |
-
|
| 5217 |
-
|
| 5218 |
-
|
| 5219 |
-
|
| 5220 |
-
|
|
|
|
|
|
|
| 5221 |
|
| 5222 |
// 允许手机端“拖动/滑动”来移动视野(本质:移动 Phaser Camera)
|
| 5223 |
// iPhone 等触屏设备默认开启;桌面端默认关闭(可手动开)。
|
|
|
|
| 2377 |
async function loadMemo() {
|
| 2378 |
const memoDate = document.getElementById('memo-date');
|
| 2379 |
const memoContent = document.getElementById('memo-content');
|
| 2380 |
+
if (!memoContent) return;
|
| 2381 |
try {
|
| 2382 |
const response = await fetch('/yesterday-memo?t=' + Date.now(), { cache: 'no-store' });
|
| 2383 |
const data = await response.json();
|
|
|
|
| 5212 |
coordsToggle = document.getElementById('coords-toggle');
|
| 5213 |
|
| 5214 |
// guest agent 将由 /agents 动态拉取并渲染到右侧访客列表
|
| 5215 |
+
if (coordsToggle) {
|
| 5216 |
+
coordsToggle.addEventListener('click', () => {
|
| 5217 |
+
showCoords = !showCoords;
|
| 5218 |
+
coordsOverlay.style.display = showCoords ? 'block' : 'none';
|
| 5219 |
+
coordsToggle.textContent = showCoords ? t('hideCoords') : t('showCoords');
|
| 5220 |
+
coordsToggle.style.background = showCoords ? '#e94560' : '#333';
|
| 5221 |
+
});
|
| 5222 |
+
}
|
| 5223 |
|
| 5224 |
// 允许手机端“拖动/滑动”来移动视野(本质:移动 Phaser Camera)
|
| 5225 |
// iPhone 等触屏设备默认开启;桌面端默认关闭(可手动开)。
|