10
0
mirror of https://github.com/LCPQ/QUESTDB_website.git synced 2024-12-25 05:43:46 +01:00

Extract data from doi

This commit is contained in:
Mickaël Véril 2019-08-22 15:23:52 +02:00
parent 0481f8305c
commit 1c7c8b0f0a
2 changed files with 9 additions and 4 deletions

View File

@ -2,16 +2,21 @@
<html>
<head>
<script src="scripts/data.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>
function update_file(filename) {
file=filename+'.json'
lnk_file.setAttribute('href',getFullDataPath(file));
lnk_file=document.getElementById('lnk_file');
getDataFromFile(file,onApplyData)
getDataFromFile(file,onApplyData);
}
function onApplyData(data) {
lnk_doi=document.getElementById('lnk_doi');
lnk_doi.setAttribute('href',getDoiUrl(data));
doiurl=getDoiUrl(data.doi);
lnk_doi.setAttribute('href',doiurl);
const Cite = require('citation-js');
let publi = new Cite(data.doi)
lnk_doi.innerHTML=publi.format('citation');
}
</script>
<script>

View File

@ -13,8 +13,8 @@ function getDataFromFile(file,fn) {
xmlhttp.send();
}
function getDoiUrl(data) {
return 'https://doi.org/'+data.doi
function getDoiUrl(doi) {
return 'https://doi.org/'+doi
}
function getFullDataPath(path) {
return 'data/'+path