bep40 commited on
Commit
3abcab7
·
verified ·
1 Parent(s): abd753a

CRITICAL: bdpOpen uses native setter + setTimeout for button click

Browse files
Files changed (1) hide show
  1. app.py +12 -3
app.py CHANGED
@@ -963,9 +963,18 @@ window.bdpOpen=function(url,aid,sl){
963
  window.location.hash='#/'+sl+'/'+aid;
964
  try{localStorage.setItem('bdp_url_'+aid,url);}catch(e){}
965
  var el=document.getElementById('article-url-input');
966
- if(el){var ta=el.querySelector('textarea');if(ta){ta.value=url;ta.dispatchEvent(new Event('input',{bubbles:true}));}}
967
- var btn=document.getElementById('btn-read-article');
968
- if(btn){var b=btn.querySelector('button');if(b)b.click();else btn.click();}
 
 
 
 
 
 
 
 
 
969
  window.scrollTo({top:0,behavior:'smooth'});
970
  };
971
 
 
963
  window.location.hash='#/'+sl+'/'+aid;
964
  try{localStorage.setItem('bdp_url_'+aid,url);}catch(e){}
965
  var el=document.getElementById('article-url-input');
966
+ if(el){
967
+ var ta=el.querySelector('textarea')||el.querySelector('input');
968
+ if(ta){
969
+ var d=Object.getOwnPropertyDescriptor(ta.tagName==='TEXTAREA'?HTMLTextAreaElement.prototype:HTMLInputElement.prototype,'value');
970
+ if(d&&d.set)d.set.call(ta,url);else ta.value=url;
971
+ ta.dispatchEvent(new Event('input',{bubbles:true}));
972
+ }
973
+ }
974
+ setTimeout(function(){
975
+ var btn=document.getElementById('btn-read-article');
976
+ if(btn){var b=btn.querySelector('button');if(b)b.click();else btn.click();}
977
+ },100);
978
  window.scrollTo({top:0,behavior:'smooth'});
979
  };
980