broadfield commited on
Commit
a33e7cb
·
verified ·
1 Parent(s): 777324c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +22 -4
app.py CHANGED
@@ -57,7 +57,11 @@ function run(inn,url) {
57
  var framediv = document.getElementById("framediv" + String(inn));
58
  let api = url;
59
  console.log(api);
60
- framediv.innerHTML = "";
 
 
 
 
61
  const iframediv = document.createElement('iframe');
62
  iframediv.src = api;
63
  iframediv.width = '100%';
@@ -67,9 +71,19 @@ function run(inn,url) {
67
  function closefn(inn) {
68
  console.log(inn);
69
  var frame_off = document.getElementById("frame" + String(inn));
70
- document.getElementById("aud" + String(inn)).innerHTML = "";
71
- document.getElementById("framediv" + String(inn)).innerHTML = "";
72
  frame_off.style.display = 'none';
 
 
 
 
 
 
 
 
 
 
73
  }
74
  function readfn(inn,url) {
75
  console.log(inn);
@@ -77,7 +91,11 @@ function readfn(inn,url) {
77
  var readit = document.getElementById("aud" + String(inn));
78
  let api = 'https://broadfield-fast-voice.hf.space/?pdfurl=' + url;
79
  console.log(api);
80
- readit.innerHTML = "";
 
 
 
 
81
  const iframe = document.createElement('iframe');
82
 
83
  iframe.src = api;
 
57
  var framediv = document.getElementById("framediv" + String(inn));
58
  let api = url;
59
  console.log(api);
60
+ let child = framediv.lastElementChild;
61
+ while (child) {
62
+ framediv.removeChild(child);
63
+ child = framediv.lastElementChild;
64
+ }
65
  const iframediv = document.createElement('iframe');
66
  iframediv.src = api;
67
  iframediv.width = '100%';
 
71
  function closefn(inn) {
72
  console.log(inn);
73
  var frame_off = document.getElementById("frame" + String(inn));
74
+ var aud = document.getElementById("aud" + String(inn));
75
+ var framedivdocument.getElementById("framediv" + String(inn));
76
  frame_off.style.display = 'none';
77
+ let child1 = aud.lastElementChild;
78
+ while (child1) {
79
+ aud.removeChild(child);
80
+ child = aud.lastElementChild;
81
+ }
82
+ let child2 = framediv.lastElementChild;
83
+ while (child2) {
84
+ framediv.removeChild(child);
85
+ child = framediv.lastElementChild;
86
+ }
87
  }
88
  function readfn(inn,url) {
89
  console.log(inn);
 
91
  var readit = document.getElementById("aud" + String(inn));
92
  let api = 'https://broadfield-fast-voice.hf.space/?pdfurl=' + url;
93
  console.log(api);
94
+ let child = readit.lastElementChild;
95
+ while (child) {
96
+ readit.removeChild(child);
97
+ child = readit.lastElementChild;
98
+ }
99
  const iframe = document.createElement('iframe');
100
 
101
  iframe.src = api;