10
0
mirror of https://github.com/LCPQ/QUESTDB_website.git synced 2024-12-26 06:14:38 +01:00

Use jQuery for click event

This commit is contained in:
Mickaël Véril 2019-10-30 13:11:35 +01:00
parent aff6512513
commit 02eb8d545a

View File

@ -28,20 +28,18 @@ draft: false
if(key[0] in queryDic){ if(key[0] in queryDic){
var filename=queryDic[key[0]]; var filename=queryDic[key[0]];
var textPromise=getTextFromFileUrlAsync(filename) var textPromise=getTextFromFileUrlAsync(filename)
btn_download=document.getElementById("btn_download"); $("#btn_download").click(function(){
btn_download.onclick=function(){
window.open(filename,"_self"); window.open(filename,"_self");
} })
document.getElementById('fileTitle').innerText=filename; document.getElementById('fileTitle').innerText=filename;
document.getElementById('fileContent').innerText=await textPromise; document.getElementById('fileContent').innerText=await textPromise;
document.getElementById('file').hidden=false; document.getElementById('file').hidden=false;
document.getElementById("div_btn").hidden=false; document.getElementById("div_btn").hidden=false;
} else if(key[1] in queryDic){ } else if(key[1] in queryDic){
var base64=queryDic[key[1]]; var base64=queryDic[key[1]];
var btn_download=document.getElementById("btn_download"); $("#btn_download").click(function(){
btn_download.onclick=function(){
window.open(String.raw`data:text/plain;base64,${base64}`,"_self") window.open(String.raw`data:text/plain;base64,${base64}`,"_self")
} })
document.getElementById('fileTitle').hudden=true document.getElementById('fileTitle').hudden=true
document.getElementById('fileContent').innerText=atob(base64) document.getElementById('fileContent').innerText=atob(base64)
document.getElementById('file').hidden=false; document.getElementById('file').hidden=false;