OzzyGT HF Staff commited on
Commit
860902e
·
1 Parent(s): bf3a568
Files changed (1) hide show
  1. app.py +11 -3
app.py CHANGED
@@ -1509,14 +1509,22 @@ CANVAS_JS = r"""
1509
  # iframe that resizes to its content, so `vh` units feed back and grow forever. Pinning a pixel
1510
  # height from window.innerHeight (updated only on real resize) breaks that loop.
1511
  HEIGHT_SYNC_JS = (
1512
- "(function(){var h=0;function s(){"
 
1513
  "var el=document.querySelector('.gradio-container');"
1514
  "var top=el?el.getBoundingClientRect().top:0;" # space taken by HF/host header above the app
1515
  "var a=Math.max(320, window.innerHeight - Math.max(0, top));"
1516
  "if(!h||a<h)h=a;" # only ever shrink: an auto-sizing embed can't make us run away
1517
- "document.documentElement.style.setProperty('--app-h', h + 'px');}"
 
 
 
 
 
 
 
1518
  "s();window.addEventListener('resize', s);window.addEventListener('load', s);"
1519
- "setTimeout(s,300);setTimeout(s,900);})();"
1520
  )
1521
  HEAD = (
1522
  "<style>\n" + CSS + "\n</style>\n"
 
1509
  # iframe that resizes to its content, so `vh` units feed back and grow forever. Pinning a pixel
1510
  # height from window.innerHeight (updated only on real resize) breaks that loop.
1511
  HEIGHT_SYNC_JS = (
1512
+ "(function(){var h=0,dbg=null;"
1513
+ "function s(){"
1514
  "var el=document.querySelector('.gradio-container');"
1515
  "var top=el?el.getBoundingClientRect().top:0;" # space taken by HF/host header above the app
1516
  "var a=Math.max(320, window.innerHeight - Math.max(0, top));"
1517
  "if(!h||a<h)h=a;" # only ever shrink: an auto-sizing embed can't make us run away
1518
+ "document.documentElement.style.setProperty('--app-h', h + 'px');"
1519
+ "try{if(!dbg&&document.body){dbg=document.createElement('div');"
1520
+ "dbg.style.cssText='position:fixed;left:2px;bottom:2px;z-index:99999;background:#000;"
1521
+ "color:#0f0;font:10px monospace;padding:2px 5px;opacity:.85;pointer-events:none';"
1522
+ "document.body.appendChild(dbg);}"
1523
+ "if(dbg)dbg.textContent='ih='+window.innerHeight+' top='+Math.round(top)+' appH='+h"
1524
+ "+' bsh='+document.body.scrollHeight+' iframe='+(window.top!==window.self)+' gc='+(!!el);"
1525
+ "}catch(e){}}"
1526
  "s();window.addEventListener('resize', s);window.addEventListener('load', s);"
1527
+ "setTimeout(s,300);setTimeout(s,900);setTimeout(s,2000);})();"
1528
  )
1529
  HEAD = (
1530
  "<style>\n" + CSS + "\n</style>\n"