2019-08-22 11:00:58 +02:00
|
|
|
function getDataFromFile(file,fn) {
|
2019-08-22 10:34:07 +02:00
|
|
|
var result = null;
|
|
|
|
var xmlhttp = new XMLHttpRequest();
|
|
|
|
xmlhttp
|
2019-08-22 11:00:58 +02:00
|
|
|
xmlhttp.open("GET",getFullDataPath(file), true);
|
|
|
|
xmlhttp.onreadystatechange = function() {
|
|
|
|
if (this.readyState == 4 && this.status == 200) {//when a good response is given do this
|
|
|
|
|
|
|
|
var data = JSON.parse(this.responseText); // convert the response to a json object
|
|
|
|
fn(data)
|
|
|
|
}
|
2019-08-22 10:34:07 +02:00
|
|
|
}
|
2019-08-22 11:00:58 +02:00
|
|
|
xmlhttp.send();
|
2019-08-22 10:34:07 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
function getDoiUrl(data) {
|
|
|
|
return 'https://doi.org/'+data.doi
|
|
|
|
}
|
|
|
|
function getFullDataPath(path) {
|
|
|
|
return 'data/'+path
|
|
|
|
}
|