Created
March 20, 2019 17:48
-
-
Save misingnoglic/61451a07b7cd20ec40c292e5ba5361ca to your computer and use it in GitHub Desktop.
Web Page for listing academic publications.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<link rel="stylesheet" href="style.css"> | |
<script> | |
fetch('http://eutils.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi?db=pubmed&term=Zaitlen, Noah[Full Author Name] OR Zaitlen, Noah[Full Investigator Name]&retmode=json&retmax=1000') | |
.then(function(response) { | |
return response.json(); | |
}).then(function(json) { | |
const ids = json.esearchresult.idlist; | |
fetch('http://eutils.ncbi.nlm.nih.gov/entrez/eutils/esummary.fcgi?db=pubmed&id=' + ids + '&retmode=json') | |
.then(function(response) { | |
return response.json(); | |
}) | |
.then(function(json) { | |
console.log(json); | |
const returnedIds = json.result.uids; | |
for (let i = 0; i<returnedIds.length; i++){ | |
let id = returnedIds[i]; | |
let currentPaper = json.result[id]; | |
let citation = ""; | |
for(author in currentPaper.authors){ | |
let name = currentPaper.authors[author].name; | |
let z = name.includes("Zaitlen"); | |
if (z){ | |
citation+='<b>' | |
} | |
citation+=name+', '; | |
if (z){ | |
citation+='</b>' | |
} | |
} | |
citation+=' \"'+currentPaper.title+'\" <i>'+currentPaper.fulljournalname+'</i> '+currentPaper.volume+'.'+currentPaper.issue+' ('+currentPaper.pubdate+'): '+currentPaper.pages+'.'; | |
let elemDiv = document.createElement('li'); | |
if (currentPaper.fulljournalname.toLowerCase().includes("nature")){ | |
elemDiv.classList.add("grad1") | |
} | |
elemDiv.innerHTML = citation; | |
document.getElementById("articles").appendChild(elemDiv); | |
} | |
}) | |
}); | |
</script> | |
</head> | |
<body> | |
<ul> | |
<div id="articles"> | |
</div> | |
</ul> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment