Spaces:
Running
Running
Commit
·
52af3d5
1
Parent(s):
cdfa223
Solution 6: CSS Transform Scale to force desktop layout on mobile
Browse files- Added media query that transforms body at 0.325 scale on mobile
- Forces html/body width to 1200px on screens ≤768px
- Removed complex JavaScript tab handlers (they broke things)
- Last attempt to make desktop experience work on mobile
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
app.py
CHANGED
|
@@ -1276,23 +1276,29 @@ custom_css = """
|
|
| 1276 |
}
|
| 1277 |
|
| 1278 |
/* Desktop-only experience - no mobile responsive CSS */
|
| 1279 |
-
/*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1280 |
"""
|
| 1281 |
|
| 1282 |
custom_js = """
|
| 1283 |
function() {
|
| 1284 |
-
// Force desktop mode - override mobile detection
|
| 1285 |
-
Object.defineProperty(navigator, 'maxTouchPoints', {
|
| 1286 |
-
get: () => 0
|
| 1287 |
-
});
|
| 1288 |
-
|
| 1289 |
-
// Override platform if needed
|
| 1290 |
-
try {
|
| 1291 |
-
Object.defineProperty(navigator, 'platform', {
|
| 1292 |
-
get: () => 'MacIntel'
|
| 1293 |
-
});
|
| 1294 |
-
} catch(e) {}
|
| 1295 |
-
|
| 1296 |
// Add click-to-expand functionality for the plot
|
| 1297 |
document.addEventListener('click', function(e) {
|
| 1298 |
const plot = e.target.closest('.expandable-plot');
|
|
@@ -1310,65 +1316,6 @@ function() {
|
|
| 1310 |
}
|
| 1311 |
}
|
| 1312 |
});
|
| 1313 |
-
|
| 1314 |
-
// Aggressive tab fixing - manually control tab panels
|
| 1315 |
-
function forceTabSwitching() {
|
| 1316 |
-
const tabs = document.querySelectorAll('[role="tab"]');
|
| 1317 |
-
const tabPanels = document.querySelectorAll('[role="tabpanel"]');
|
| 1318 |
-
|
| 1319 |
-
if (tabs.length === 0 || tabPanels.length === 0) return;
|
| 1320 |
-
|
| 1321 |
-
tabs.forEach((tab, index) => {
|
| 1322 |
-
// Remove old listeners by cloning
|
| 1323 |
-
const newTab = tab.cloneNode(true);
|
| 1324 |
-
tab.parentNode.replaceChild(newTab, tab);
|
| 1325 |
-
|
| 1326 |
-
// Add new click handler that manually shows/hides panels
|
| 1327 |
-
newTab.addEventListener('click', function(e) {
|
| 1328 |
-
e.preventDefault();
|
| 1329 |
-
e.stopPropagation();
|
| 1330 |
-
|
| 1331 |
-
// Hide all panels
|
| 1332 |
-
tabPanels.forEach(panel => {
|
| 1333 |
-
panel.style.display = 'none';
|
| 1334 |
-
panel.setAttribute('aria-hidden', 'true');
|
| 1335 |
-
});
|
| 1336 |
-
|
| 1337 |
-
// Remove selected from all tabs
|
| 1338 |
-
tabs.forEach(t => {
|
| 1339 |
-
t.setAttribute('aria-selected', 'false');
|
| 1340 |
-
t.classList.remove('selected');
|
| 1341 |
-
});
|
| 1342 |
-
|
| 1343 |
-
// Show clicked tab's panel
|
| 1344 |
-
if (tabPanels[index]) {
|
| 1345 |
-
tabPanels[index].style.display = 'block';
|
| 1346 |
-
tabPanels[index].setAttribute('aria-hidden', 'false');
|
| 1347 |
-
}
|
| 1348 |
-
|
| 1349 |
-
// Mark clicked tab as selected
|
| 1350 |
-
this.setAttribute('aria-selected', 'true');
|
| 1351 |
-
this.classList.add('selected');
|
| 1352 |
-
}, true);
|
| 1353 |
-
});
|
| 1354 |
-
|
| 1355 |
-
// Ensure first tab is initially selected
|
| 1356 |
-
if (tabPanels.length > 0) {
|
| 1357 |
-
tabPanels.forEach((panel, i) => {
|
| 1358 |
-
panel.style.display = i === 0 ? 'block' : 'none';
|
| 1359 |
-
});
|
| 1360 |
-
}
|
| 1361 |
-
}
|
| 1362 |
-
|
| 1363 |
-
// Run tab fixing multiple times
|
| 1364 |
-
setTimeout(forceTabSwitching, 200);
|
| 1365 |
-
setTimeout(forceTabSwitching, 800);
|
| 1366 |
-
setTimeout(forceTabSwitching, 1500);
|
| 1367 |
-
|
| 1368 |
-
const observer = new MutationObserver(() => {
|
| 1369 |
-
setTimeout(forceTabSwitching, 100);
|
| 1370 |
-
});
|
| 1371 |
-
observer.observe(document.body, { childList: true, subtree: true });
|
| 1372 |
}
|
| 1373 |
"""
|
| 1374 |
|
|
|
|
| 1276 |
}
|
| 1277 |
|
| 1278 |
/* Desktop-only experience - no mobile responsive CSS */
|
| 1279 |
+
/* Solution 6: Force desktop rendering with CSS transform on mobile */
|
| 1280 |
+
|
| 1281 |
+
/* Force desktop viewport behavior on narrow screens */
|
| 1282 |
+
@media screen and (max-width: 768px) {
|
| 1283 |
+
html, body {
|
| 1284 |
+
width: 1200px !important;
|
| 1285 |
+
overflow-x: scroll !important;
|
| 1286 |
+
}
|
| 1287 |
+
|
| 1288 |
+
body {
|
| 1289 |
+
transform: scale(0.325);
|
| 1290 |
+
transform-origin: top left;
|
| 1291 |
+
min-height: calc(100vh / 0.325);
|
| 1292 |
+
}
|
| 1293 |
+
|
| 1294 |
+
.gradio-container {
|
| 1295 |
+
width: 1200px !important;
|
| 1296 |
+
}
|
| 1297 |
+
}
|
| 1298 |
"""
|
| 1299 |
|
| 1300 |
custom_js = """
|
| 1301 |
function() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1302 |
// Add click-to-expand functionality for the plot
|
| 1303 |
document.addEventListener('click', function(e) {
|
| 1304 |
const plot = e.target.closest('.expandable-plot');
|
|
|
|
| 1316 |
}
|
| 1317 |
}
|
| 1318 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1319 |
}
|
| 1320 |
"""
|
| 1321 |
|