We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 1487519 commit 1cee590Copy full SHA for 1cee590
1 file changed
assets/script.js
@@ -0,0 +1,15 @@
1
+document.querySelectorAll('.citation[data-doi]').forEach(el => {
2
+ const doi = el.getAttribute('data-doi');
3
+ const id = el.id;
4
+
5
+ const url = `https://api.crossref.org/works/${encodeURIComponent(doi)}`;
6
+ fetch(url)
7
+ .then(res => res.json())
8
+ .then(data => {
9
+ const count = data.message['is-referenced-by-count'];
10
+ el.textContent = `- CITATIONS: ${count} -`;
11
+ })
12
+ .catch(() => {
13
+ el.textContent = '';
14
+ });
15
+});
0 commit comments