anonymousauthors commited on
Commit
000490a
β€’
1 Parent(s): 1932762

Update pages/1_πŸ“™_Dictionary_(Browse).py

Browse files
pages/1_πŸ“™_Dictionary_(Browse).py CHANGED
@@ -10,7 +10,34 @@ from PyDictionary import PyDictionary
10
  dictionary=PyDictionary()
11
 
12
  st.set_page_config(layout="wide", page_title="ACl23 Secret Language")
 
13
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14
 
15
  # st.title("ACl23 Secret Language")
16
 
 
10
  dictionary=PyDictionary()
11
 
12
  st.set_page_config(layout="wide", page_title="ACl23 Secret Language")
13
+ from streamlit.components.v1 import html
14
 
15
+ def nav_page(page_name, timeout_secs=3):
16
+ nav_script = """
17
+ <script type="text/javascript">
18
+ function attempt_nav_page(page_name, start_time, timeout_secs) {
19
+ var links = window.parent.document.getElementsByTagName("a");
20
+ for (var i = 0; i < links.length; i++) {
21
+ if (links[i].href.toLowerCase().endsWith("/" + page_name.toLowerCase())) {
22
+ links[i].click();
23
+ return;
24
+ }
25
+ }
26
+ var elasped = new Date() - start_time;
27
+ if (elasped < timeout_secs * 1000) {
28
+ setTimeout(attempt_nav_page, 100, page_name, start_time, timeout_secs);
29
+ } else {
30
+ alert("Unable to navigate to page '" + page_name + "' after " + timeout_secs + " second(s).");
31
+ }
32
+ }
33
+ window.addEventListener("load", function() {
34
+ attempt_nav_page("%s", new Date(), %d);
35
+ });
36
+ </script>
37
+ """ % (page_name, timeout_secs)
38
+ html(nav_script)
39
+ if st.button("< Prev"):
40
+ nav_page("πŸ“™_Dictionary_(Search)")
41
 
42
  # st.title("ACl23 Secret Language")
43