freealise commited on
Commit
822a192
1 Parent(s): 2661cae

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -10
app.py CHANGED
@@ -556,22 +556,22 @@ with gr.Blocks(css=css) as demo:
556
  this.value = \"\";
557
  }
558
  }
559
- '/><pre id='keymap'>
560
- ` 1 2 3 4 5 6 7 8 9 0 - =
561
- Q W E R T Y U I O P { }
562
- A S D F G H J K L ; '
563
- Z X C V B N M , . /
564
- move rotate scale
565
- </pre><script>
566
- alert(\"hi\");
567
- document.getElementById(\"keymap\").innerHTML = document.getElementById(\"keymap\").innerText.replace(/\s[weasdzx]\s/gi, function(c){
568
  return \"<b style=&quot;color:red&quot;>\" + c.toUpperCase() + \"</b>\";
569
  }).replace(/\s[tyfghvb]\s/gi, function(c){
570
  return \"<b style=&quot;color:green&quot;>\" + c.toUpperCase() + \"</b>\";
571
  }).replace(/\s[iojklm,]\s/gi, function(c){
572
  return \"<b style=&quot;color:blue&quot;>\" + c.toUpperCase() + \"</b>\";
573
  });
574
- </script>""")
 
 
 
 
 
 
575
  selected = gr.Number(elem_id="fnum", value=0, minimum=0, maximum=256, interactive=False)
576
  output_frame.select(fn=select_frame, inputs=None, outputs=[output_depth, selected], show_progress='hidden')
577
  output_depth.select(fn=select_frame, inputs=None, outputs=[output_frame, selected], show_progress='hidden')
 
556
  this.value = \"\";
557
  }
558
  }
559
+ ' onfocus='if (document.getElementById(\"keymap\").style.color != \"white\") {
560
+ document.getElementById(\"keymap\").style.color = \"white\";
561
+ document.getElementById(\"keymap\").innerHTML = document.getElementById(\"keymap\").innerHTML.replace(/\s[weasdzx]\s/gi, function(c){
 
 
 
 
 
 
562
  return \"<b style=&quot;color:red&quot;>\" + c.toUpperCase() + \"</b>\";
563
  }).replace(/\s[tyfghvb]\s/gi, function(c){
564
  return \"<b style=&quot;color:green&quot;>\" + c.toUpperCase() + \"</b>\";
565
  }).replace(/\s[iojklm,]\s/gi, function(c){
566
  return \"<b style=&quot;color:blue&quot;>\" + c.toUpperCase() + \"</b>\";
567
  });
568
+ }'/><pre id='keymap'>
569
+ ` 1 2 3 4 5 6 7 8 9 0 - =
570
+ Q W E R T Y U I O P { }
571
+ A S D F G H J K L ; '
572
+ Z X C V B N M , . /
573
+ move rotate scale
574
+ </pre>""")
575
  selected = gr.Number(elem_id="fnum", value=0, minimum=0, maximum=256, interactive=False)
576
  output_frame.select(fn=select_frame, inputs=None, outputs=[output_depth, selected], show_progress='hidden')
577
  output_depth.select(fn=select_frame, inputs=None, outputs=[output_frame, selected], show_progress='hidden')