sujalappa commited on
Commit
8ca1f85
·
verified ·
1 Parent(s): 542f06b

OreSight web app

Browse files
geoscan/geoscan/webapp/static/landing.html CHANGED
@@ -58,7 +58,7 @@
58
  <div class="card">
59
  <h2>Already have an account?</h2>
60
  <p>Sign in with the user name and password you were given.</p>
61
- <a class="btn ghost" href="/app" target="_top">Sign in</a>
62
  </div>
63
  </main>
64
  <script>
@@ -77,6 +77,19 @@
77
  who.addEventListener("input", links);
78
  org.addEventListener("input", links);
79
  links();
 
 
 
 
 
 
 
 
 
 
 
 
 
80
  if (!EMAIL) document.getElementById("request-card").hidden = true;
81
  </script>
82
  </body>
 
58
  <div class="card">
59
  <h2>Already have an account?</h2>
60
  <p>Sign in with the user name and password you were given.</p>
61
+ <a class="btn ghost" id="signin" href="/app">Sign in</a>
62
  </div>
63
  </main>
64
  <script>
 
77
  who.addEventListener("input", links);
78
  org.addEventListener("input", links);
79
  links();
80
+
81
+ // Inside a frame (e.g. the Hugging Face Space page) the page may not navigate the whole window, and a
82
+ // login box would be blocked anyway. There, open the app and the mail link in a new tab instead.
83
+ const framed = (() => { try { return window.self !== window.top; } catch (e) { return true; } })();
84
+ if (framed) {
85
+ for (const id of ["signin", "mailto"]) {
86
+ document.getElementById(id).addEventListener("click", (ev) => {
87
+ ev.preventDefault();
88
+ const href = ev.currentTarget.getAttribute("href");
89
+ window.open(href.startsWith("/") ? location.origin + href : href, "_blank", "noopener");
90
+ });
91
+ }
92
+ }
93
  if (!EMAIL) document.getElementById("request-card").hidden = true;
94
  </script>
95
  </body>