mirror of
https://github.com/LCPQ/QUESTDB_website.git
synced 2024-11-09 07:33:52 +01:00
97 lines
3.6 KiB
HTML
97 lines
3.6 KiB
HTML
---
|
|
title: "Welcome"
|
|
date: 2019-08-29 09:00
|
|
draft: false
|
|
---
|
|
<script src="/scripts/data.js" type="text/javascript"></script>
|
|
<script src="/scripts/getFullDataPath.js" type="text/javascript"></script>
|
|
<script src="/scripts/getTextFromFile.js" type="text/javascript"></script>
|
|
<script src="https://cdn.rawgit.com/larsgw/citation.js/archive/citation.js/citation-0.4.0-9.js" type="text/javascript"></script>
|
|
<script src="https://polyfill.io/v3/polyfill.min.js?features=es6"></script>
|
|
<script type="text/javascript" id="MathJax-script" async
|
|
src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-chtml.js">
|
|
</script>
|
|
{{< getDataFilesName >}}
|
|
<script>
|
|
window.onload=function()
|
|
{
|
|
fsel=document.getElementById("fileSelect")
|
|
getDataFilesName().forEach(function(element) {
|
|
op=document.createElement("option");
|
|
op.value=element;
|
|
op.innerText=element.split('.')[0];
|
|
fsel.appendChild(op);
|
|
});
|
|
}
|
|
async function update_file(file) {
|
|
var lnk_file=document.getElementById('lnk_file');
|
|
lnk_file.setAttribute('href',String.raw`view?dataFile=${file}`);
|
|
dat= await data.loadAsync(file);
|
|
await applyData(dat);
|
|
}
|
|
async function applyData(dat) {
|
|
const Cite = require('citation-js');
|
|
// Start an async task to get publi data
|
|
let publiPromise = Cite.async(dat.doi.string)
|
|
const LatexInline=['\\(','\\)']
|
|
var par=document.getElementById("data_par")
|
|
par.innerHTML='';
|
|
var md=[];
|
|
var els=[];
|
|
md.push(["Title",dat.title]);
|
|
md.push(["Code",dat.code]);
|
|
md.push(["Geometry",dat.geometry])
|
|
md.push(["Method",dat.method])
|
|
md.push(["Basis",dat.basis]);
|
|
md.push(["DOI",dat.doi]);
|
|
md.forEach(function(element){
|
|
var node = document.createElement("div");
|
|
node.innerText= element[0]+': '+element[1];
|
|
par.appendChild(node);
|
|
});
|
|
var exDiv= document.createElement("div");
|
|
par.appendChild(exDiv);
|
|
var exTitle = document.createElement("h2");
|
|
exTitle.innerText= "Excitations";
|
|
exDiv.appendChild(exTitle);
|
|
var exPar= document.createElement("p");
|
|
exDiv.appendChild(exPar);
|
|
await dat.excitations.reduce(async (promise,el)=> {
|
|
await promise;
|
|
var node = document.createElement("div");
|
|
node.innerHTML= String.raw`${LatexInline[0]} ${el.start.toLaTeX()} \rightarrow ${el.end.toLaTeX()}${LatexInline[1]}, ${LatexInline[0]}${el.Eabs.toPrecision(3)}\:\mathrm{eV}${LatexInline[1]}`;
|
|
node.hidden=true
|
|
exPar.appendChild(node);
|
|
await MathJax.typesetPromise();
|
|
node.hidden=false;
|
|
});
|
|
|
|
|
|
var lnkdoi = document.createElement("a");
|
|
// Wait for the value of publi when required
|
|
let publi=await publiPromise;
|
|
let output = publi.format('bibliography', {
|
|
format: 'html',
|
|
template: 'apa',
|
|
lang: 'en-US'
|
|
})
|
|
lnkdoi.innerHTML=output
|
|
lnkdoi.setAttribute('target','_blank');
|
|
lnkdoi.setAttribute('href',dat.doi.url);
|
|
par.appendChild(lnkdoi);
|
|
}
|
|
</script>
|
|
<script>
|
|
function onValueChange(e) {
|
|
update_file(e.target.value);
|
|
}
|
|
</script>
|
|
|
|
<label>Write a data file name without extension<br/>
|
|
<select id="fileSelect" onchange="onValueChange(event)">
|
|
<option value="" disabled=true selected=true>Select a file</option>
|
|
</select>
|
|
</label><br/>
|
|
<h1>Data</h1>
|
|
<p id=data_par></p>
|
|
<a target="_blank" id='lnk_file'>Go to file</a> |