Spaces:
Running
Running
Update app.py
#4
by volivers - opened
app.py
CHANGED
|
@@ -2336,8 +2336,15 @@ SELECTION_JS = """
|
|
| 2336 |
document.body.classList.toggle('dark', dark);
|
| 2337 |
const container = document.querySelector('.gradio-container');
|
| 2338 |
if (container) container.classList.toggle('dark', dark);
|
| 2339 |
-
|
| 2340 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2341 |
}
|
| 2342 |
function toggleDark() {
|
| 2343 |
const url = new URL(window.location);
|
|
|
|
| 2336 |
document.body.classList.toggle('dark', dark);
|
| 2337 |
const container = document.querySelector('.gradio-container');
|
| 2338 |
if (container) container.classList.toggle('dark', dark);
|
| 2339 |
+
// Sync emoji and checkbox — retry until element is available
|
| 2340 |
+
function syncUI() {
|
| 2341 |
+
const el = document.getElementById('theme-emoji');
|
| 2342 |
+
const cb = document.getElementById('dark-toggle-btn');
|
| 2343 |
+
if (el) el.textContent = dark ? '☀️' : '🌙';
|
| 2344 |
+
if (cb) cb.checked = dark;
|
| 2345 |
+
if (!el || !cb) requestAnimationFrame(syncUI);
|
| 2346 |
+
}
|
| 2347 |
+
syncUI();
|
| 2348 |
}
|
| 2349 |
function toggleDark() {
|
| 2350 |
const url = new URL(window.location);
|