K00B404 commited on
Commit
8c665cb
·
verified ·
1 Parent(s): 3156876

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +27 -1
app.py CHANGED
@@ -373,10 +373,36 @@ body {
373
  }
374
  }
375
  """
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
376
 
 
 
 
377
 
378
  with gr.Blocks( css=css) as app:
379
- gr.HTML(title_html) # title html
380
  with gr.Column(elem_id="app-container"):
381
  with gr.Row():
382
  with gr.Column(elem_id="prompt-container"):
 
373
  }
374
  }
375
  """
376
+ js_script = """
377
+ <script>
378
+ function detectWindowChange() {
379
+ let lastX = window.screenX;
380
+ let lastY = window.screenY;
381
+ let lastW = window.innerWidth;
382
+ let lastH = window.innerHeight;
383
+
384
+ setInterval(async function() {
385
+ if (window.screenX !== lastX || window.screenY !== lastY ||
386
+ window.innerWidth !== lastW || window.innerHeight !== lastH) {
387
+
388
+ lastX = window.screenX;
389
+ lastY = window.screenY;
390
+ lastW = window.innerWidth;
391
+ lastH = window.innerHeight;
392
+
393
+ let response = await fetch("/get_bounds");
394
+ let data = await response.json();
395
+ updateNeonGlow(data.x, data.y, data.w, data.h);
396
+ }
397
+ }, 500);
398
+ }
399
 
400
+ detectWindowChange();
401
+ </script>
402
+ """
403
 
404
  with gr.Blocks( css=css) as app:
405
+ gr.HTML(title_html+ js_script) # title html
406
  with gr.Column(elem_id="app-container"):
407
  with gr.Row():
408
  with gr.Column(elem_id="prompt-container"):