-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrender.html
More file actions
33 lines (25 loc) · 800 Bytes
/
render.html
File metadata and controls
33 lines (25 loc) · 800 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<html>
<script>
function render(data){
const item = randomRow(data);
const imgUrl = "https://test.covid.postera.ai/synthesize/" + encodeURI(item.gsx$smilesparent.$t);
const text = `
SMILES: ${item.gsx$smilesparent.$t}</p>
InChIKey: ${item.gsx$inchikey.$t}</p>
Link: ${item.gsx$wikilink.$t}</p>
<img src="${imgUrl}">`;
document.querySelector("#molecule").innerHTML = text;
}
function randomRow(data){
const rand = Math.floor(Math.random() * data.feed.entry.length);
return data.feed.entry[rand];
}
fetch('https://spreadsheets.google.com/feeds/list/168-a1_l51Nfbms67eG8zU8p-EhEtEO26FUzRInbu7fY/1/public/full?alt=json')
.then(response => response.json())
.then(data => render(data));
</script>
<body>
<div id="molecule">
</div>
</body>
</html>