Spaces:
Sleeping
Sleeping
Pointf5ive commited on
Commit ·
f21149b
1
Parent(s): bef6364
Keep dashboard intake controls mounted after refresh
Browse files
app.py
CHANGED
|
@@ -1416,24 +1416,32 @@ HEAD = """
|
|
| 1416 |
return true;
|
| 1417 |
};
|
| 1418 |
|
| 1419 |
-
const
|
| 1420 |
-
const
|
| 1421 |
-
|
| 1422 |
-
|
| 1423 |
-
|
| 1424 |
-
mount.appendChild(row);
|
| 1425 |
}
|
|
|
|
| 1426 |
};
|
| 1427 |
|
| 1428 |
-
const
|
| 1429 |
-
const mount = document.getElementById(
|
| 1430 |
-
const row =
|
| 1431 |
if (!mount || !row) return;
|
| 1432 |
if (row.parentElement !== mount) {
|
| 1433 |
mount.appendChild(row);
|
| 1434 |
}
|
| 1435 |
};
|
| 1436 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1437 |
const mountDashboardControls = () => {
|
| 1438 |
mountRunButton();
|
| 1439 |
mountIntakeRow();
|
|
|
|
| 1416 |
return true;
|
| 1417 |
};
|
| 1418 |
|
| 1419 |
+
const persistentNode = (key, id) => {
|
| 1420 |
+
const live = document.getElementById(id);
|
| 1421 |
+
if (live) {
|
| 1422 |
+
window[key] = live;
|
| 1423 |
+
return live;
|
|
|
|
| 1424 |
}
|
| 1425 |
+
return window[key] || null;
|
| 1426 |
};
|
| 1427 |
|
| 1428 |
+
const mountPersistentRow = (mountId, rowId, key) => {
|
| 1429 |
+
const mount = document.getElementById(mountId);
|
| 1430 |
+
const row = persistentNode(key, rowId);
|
| 1431 |
if (!mount || !row) return;
|
| 1432 |
if (row.parentElement !== mount) {
|
| 1433 |
mount.appendChild(row);
|
| 1434 |
}
|
| 1435 |
};
|
| 1436 |
|
| 1437 |
+
const mountIntakeRow = () => {
|
| 1438 |
+
mountPersistentRow('totem-intake-mount', 'intake-row', '__totemIntakeRow');
|
| 1439 |
+
};
|
| 1440 |
+
|
| 1441 |
+
const mountRunButton = () => {
|
| 1442 |
+
mountPersistentRow('totem-run-mount', 'totem-run-button-row', '__totemRunButtonRow');
|
| 1443 |
+
};
|
| 1444 |
+
|
| 1445 |
const mountDashboardControls = () => {
|
| 1446 |
mountRunButton();
|
| 1447 |
mountIntakeRow();
|