10
0
mirror of https://github.com/LCPQ/QUESTDB_website.git synced 2024-12-26 06:14:38 +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> <html>
<head> <head>
<script src="scripts/data.js" type="text/javascript"></script> <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> <script>
function update_file(filename) { function update_file(filename) {
file=filename+'.json' file=filename+'.json'
lnk_file.setAttribute('href',getFullDataPath(file)); lnk_file.setAttribute('href',getFullDataPath(file));
lnk_file=document.getElementById('lnk_file'); lnk_file=document.getElementById('lnk_file');
getDataFromFile(file,onApplyData) getDataFromFile(file,onApplyData);
} }
function onApplyData(data) { function onApplyData(data) {
lnk_doi=document.getElementById('lnk_doi'); 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>
<script> <script>

View File

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