2019-09-09 15:20:30 +02:00
|
|
|
<!DOCTYPE html>
|
|
|
|
<html>
|
|
|
|
<head>
|
|
|
|
<title>view</title>
|
|
|
|
<meta name="save_as" content="view.html"></meta>
|
|
|
|
<meta name="date" content="2019-08-29 09:00"></meta>
|
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<script src="{static}/scripts/getFullDataPath.js" type="text/javascript"></script>
|
|
|
|
<script src="{static}/scripts/getTextFromFile.js" type="text/javascript"></script>
|
2019-09-10 14:37:44 +02:00
|
|
|
<script src="{static}/scripts/parseQueryStringToDictionary.js" type="text/javascript"></script>
|
2019-09-09 15:20:30 +02:00
|
|
|
<script>
|
|
|
|
|
|
|
|
window.onload=async function(){
|
|
|
|
if(typeof(navigator.clipboard) == 'undefined' || typeof(navigator.clipboard.writeText) === 'undefined'){
|
|
|
|
btn_clip=document.getElementById("btn_clip");
|
|
|
|
btn_clip.disabled = true;
|
2019-09-10 14:10:57 +02:00
|
|
|
var browsers= {};
|
|
|
|
browsers["Chromium"]="https://www.mozilla.org/fr/firefox";
|
|
|
|
browsers["Firefox"]="https://chromium.woolyss.com/download";
|
|
|
|
var recomsting="We recomend to use Firefox or a Chromium based browser like Google Chrome";
|
|
|
|
btn_clip.title='This feature is not supported in this bowser\n'+recomsting;
|
|
|
|
var mystr='navigator.clipboard.writeText() not supported in this browser\n'+recomsting;
|
|
|
|
for(var key in browsers) {
|
|
|
|
mystr+="\n"+String.raw`Download ${key} : ${browsers[key]}`;
|
|
|
|
}
|
|
|
|
console.warn(mystr);
|
2019-09-09 15:20:30 +02:00
|
|
|
}
|
2019-09-10 14:37:44 +02:00
|
|
|
queryDic=parseQueryStringToDictionary()
|
|
|
|
key="dataFile"
|
|
|
|
if(queryDic[key]!=undefined){
|
|
|
|
var filename=queryDic[key];
|
2019-09-09 15:20:30 +02:00
|
|
|
var path=getFullDataPath(filename);
|
|
|
|
var textPromise=getTextFromFileAsync(path)
|
|
|
|
btn_download=document.getElementById("btn_download");
|
|
|
|
btn_download.onclick=function(){
|
|
|
|
window.open(path,"_self");
|
|
|
|
}
|
|
|
|
var preNode= document.getElementById('fileContent');
|
|
|
|
preNode.hidden=false;
|
|
|
|
preNode.innerText=await textPromise;
|
|
|
|
document.getElementById("div_btn").hidden=false;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
document.getElementById('error_P').hidden=false;
|
|
|
|
errNode;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
<script>
|
|
|
|
function Copy()
|
|
|
|
{
|
|
|
|
navigator.clipboard.writeText(document.getElementById('fileContent').innerText);
|
|
|
|
};
|
|
|
|
|
|
|
|
</script>
|
|
|
|
</script>
|
|
|
|
</script>
|
|
|
|
<div>
|
|
|
|
<p id="error_P" style="color: red; font-weight: bold" hidden=true>
|
|
|
|
Error
|
|
|
|
</p>
|
|
|
|
<pre id="fileContent" hidden=true></pre>
|
|
|
|
</div>
|
|
|
|
<div id="div_btn" hidden=true>
|
|
|
|
<button id="btn_clip" onclick="Copy()">Copy content</button>
|
|
|
|
<button id='btn_download'>Download</button>
|
|
|
|
</div>
|
|
|
|
</body>
|
|
|
|
</html>
|