broadfield commited on
Commit
9ca0fe5
·
verified ·
1 Parent(s): 419f14a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -0
app.py CHANGED
@@ -47,6 +47,11 @@ function closefn(inn) {
47
  var frame_off = document.getElementById("frame" + String(inn));
48
  frame_off.style.display = 'none';
49
  }
 
 
 
 
 
50
  </script>
51
  """
52
 
@@ -63,6 +68,7 @@ def search(q,rn,st):
63
  <div><a href='{pdflink}' target='_blank'>{pdflink}</a></div>
64
  </div>
65
  <div id=frame{i} class='frame_class'>
 
66
  <div id=close{i} class='x_btn' onclick='closefn({i})'>X</div>
67
  <iframe src="https://docs.google.com/viewer?url={c['id'].replace('/abs/','/pdf/')}&embedded=true" frameborder="0" height="1200px" width="100%"></iframe></div>"""
68
  return html
@@ -102,6 +108,7 @@ with gr.Blocks(css=style,head=head) as b:
102
  html_out=gr.HTML()
103
  json_out=gr.JSON()
104
 
 
105
  hid_start=gr.Number(step=1,value=0,visible=False, interactive=False)
106
 
107
  next_btn.click(next_show,[hid_start],[prev_btn,hid_start]).then(show_num,hid_start,show_html).then(search,[query,num,hid_start],[html_out])
 
47
  var frame_off = document.getElementById("frame" + String(inn));
48
  frame_off.style.display = 'none';
49
  }
50
+ function readfn(inn) {
51
+ console.log(inn);
52
+ var frame_off = document.getElementById("read" + String(inn));
53
+ frame_off.value = inn;
54
+ }
55
  </script>
56
  """
57
 
 
68
  <div><a href='{pdflink}' target='_blank'>{pdflink}</a></div>
69
  </div>
70
  <div id=frame{i} class='frame_class'>
71
+ <div id=read{i} class='read_btn' onclick='readfn({i})'>X</div>
72
  <div id=close{i} class='x_btn' onclick='closefn({i})'>X</div>
73
  <iframe src="https://docs.google.com/viewer?url={c['id'].replace('/abs/','/pdf/')}&embedded=true" frameborder="0" height="1200px" width="100%"></iframe></div>"""
74
  return html
 
108
  html_out=gr.HTML()
109
  json_out=gr.JSON()
110
 
111
+ hid_start=gr.Number(elem_id='read',step=1,value=0,visible=False, interactive=True)
112
  hid_start=gr.Number(step=1,value=0,visible=False, interactive=False)
113
 
114
  next_btn.click(next_show,[hid_start],[prev_btn,hid_start]).then(show_num,hid_start,show_html).then(search,[query,num,hid_start],[html_out])