mirror of
https://github.com/LCPQ/QUESTDB_website.git
synced 2024-12-25 13:53:48 +01:00
Add output
This commit is contained in:
parent
68bab37397
commit
cd2d967f71
@ -9,6 +9,9 @@
|
|||||||
<script src="{static}/scripts/data.js" type="text/javascript"></script>
|
<script src="{static}/scripts/data.js" type="text/javascript"></script>
|
||||||
<script src="{static}/scripts/getFullDataPath.js" type="text/javascript"></script>
|
<script src="{static}/scripts/getFullDataPath.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://cdn.rawgit.com/larsgw/citation.js/archive/citation.js/citation-0.4.0-9.js" type="text/javascript"></script>
|
||||||
|
<script type="text/javascript" async
|
||||||
|
src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js?config=TeX-MML-AM_CHTML" async>
|
||||||
|
</script>
|
||||||
<script>
|
<script>
|
||||||
function update_file(filename) {
|
function update_file(filename) {
|
||||||
file=filename+'.dat'
|
file=filename+'.dat'
|
||||||
@ -17,16 +20,47 @@
|
|||||||
data.load(file,onApplyData);
|
data.load(file,onApplyData);
|
||||||
}
|
}
|
||||||
function onApplyData(dat) {
|
function onApplyData(dat) {
|
||||||
lnk_doi=document.getElementById('lnk_doi');
|
|
||||||
doiurl=dat.doi.url;
|
|
||||||
lnk_doi.setAttribute('href',doiurl);
|
|
||||||
const Cite = require('citation-js');
|
const Cite = require('citation-js');
|
||||||
|
const LatexInline=['\\(','\\)']
|
||||||
|
par=document.getElementById("data_par")
|
||||||
|
par.innerHTML='';
|
||||||
|
var md=[];
|
||||||
|
var els=[];
|
||||||
|
md.push(["Title",dat.title]);
|
||||||
|
md.push(["Code",dat.code]);
|
||||||
|
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 node = document.createElement("h");
|
||||||
|
node.innerText= "Excitations";
|
||||||
|
par.appendChild(node);
|
||||||
|
dat.excitations.forEach(function(el) {
|
||||||
|
var node = document.createElement("div");
|
||||||
|
node.innerHTML= String.raw`${LatexInline[0]} ${el.start.toLaTeX()} \rightarrow ${el.end.toLaTeX()}${LatexInline[1]}, ${LatexInline[0]}${el.Eabs}\:\mathrm{eV}${LatexInline[1]}`;
|
||||||
|
MathJax.Hub.Queue(["Typeset",MathJax.Hub,node]);
|
||||||
|
par.appendChild(node);
|
||||||
|
|
||||||
|
});
|
||||||
let publi = new Cite(dat.doi.string)
|
let publi = new Cite(dat.doi.string)
|
||||||
lnk_doi.innerHTML=publi.format('citation');
|
var lnkdoi = document.createElement("a");
|
||||||
|
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>
|
||||||
<script>
|
<script>
|
||||||
window.onload=function() {
|
window.onload=function() {
|
||||||
|
console.info("Loaded")
|
||||||
var inp = document.getElementById("inp_filename");
|
var inp = document.getElementById("inp_filename");
|
||||||
inp.addEventListener("keydown", function (e) {
|
inp.addEventListener("keydown", function (e) {
|
||||||
if (e.keyCode === 13) { //checks whether the pressed key is "Enter"
|
if (e.keyCode === 13) { //checks whether the pressed key is "Enter"
|
||||||
@ -40,7 +74,7 @@
|
|||||||
<label>Write a data file name without extension<br/>
|
<label>Write a data file name without extension<br/>
|
||||||
<input type="text" id='inp_filename'></input>
|
<input type="text" id='inp_filename'></input>
|
||||||
</label><br/>
|
</label><br/>
|
||||||
<a target="_blank" id='lnk_doi'>Go to paper</a>
|
<p id=data_par></p>
|
||||||
<a target="_blank" id='lnk_file'>Go to file</a>
|
<a target="_blank" id='lnk_file' type='text/plain'>Go to file</a>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
@ -36,8 +36,7 @@ class state{
|
|||||||
return str;
|
return str;
|
||||||
};
|
};
|
||||||
toLaTeX() {
|
toLaTeX() {
|
||||||
var tex=this.number;
|
var tex= String.raw`${this.number}\:\vphantom{\mathrm{${this.symetry.charAt(0)}}}^{${this.multiplicity}}\mathrm{${this.symetry}}`;
|
||||||
tex+= String.raw` \vphantom{${this.symetry.charAt(0)}}^{${this.multiplicity}}${this.symetry}`;
|
|
||||||
return tex;
|
return tex;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user