ml-visoft commited on
Commit
6391efa
·
1 Parent(s): b619658

Try to fix redirect.

Browse files
Files changed (1) hide show
  1. main.py +18 -14
main.py CHANGED
@@ -984,31 +984,35 @@ iframe_overlay_style= """
984
 
985
  iframe_js_detect = """
986
  function isInIframe() {
987
- try {
988
- return window.self !== window.top;
989
- } catch (e) {
990
- return true;
991
- }
992
- }
993
-
994
- function showOverlay() {
995
- const overlay = document.getElementById('iframe-overlay');
996
- overlay.style.display = 'block';
997
  }
998
 
999
  if (isInIframe()) {
1000
- showOverlay();
1001
  }
 
1002
  """
1003
 
 
1004
  def html_get_iframe_overlay():
 
 
 
 
 
1005
  msgs = [
1006
  H2("Access the space directly to get full functionality:"),
1007
  H3("Click the link below:"),
1008
- A("ml-visoft-c-reviewer.hf.space", href="https://ml-visoft-c-reviewer.hf.space/"),
 
 
 
 
 
 
1009
  ]
1010
- divs = Div(Div(*msgs, id="iframe-overlay-content"), id="iframe-overlay")
1011
- return divs
1012
 
1013
  @rt("/")
1014
  def index_get(session):
 
984
 
985
  iframe_js_detect = """
986
  function isInIframe() {
987
+ try { return window.self !== window.top; } catch (e) { return true; }
 
 
 
 
 
 
 
 
 
988
  }
989
 
990
  if (isInIframe()) {
991
+ document.getElementById('iframe-overlay').style.display = 'block';
992
  }
993
+
994
  """
995
 
996
+
997
  def html_get_iframe_overlay():
998
+ open_btn = Button(
999
+ "Open in a new tab",
1000
+ onclick="window.open('https://ml-visoft-c-reviewer.hf.space/', '_blank', 'noopener');"
1001
+ )
1002
+
1003
  msgs = [
1004
  H2("Access the space directly to get full functionality:"),
1005
  H3("Click the link below:"),
1006
+ A(
1007
+ "ml-visoft-c-reviewer.hf.space",
1008
+ href="https://ml-visoft-c-reviewer.hf.space/",
1009
+ target="_blank",
1010
+ rel="noopener noreferrer" # important for security
1011
+ ),
1012
+ open_btn
1013
  ]
1014
+ return Div(Div(*msgs, id="iframe-overlay-content"), id="iframe-overlay")
1015
+
1016
 
1017
  @rt("/")
1018
  def index_get(session):