Skip to content

Commit a29ca6b

Browse files
committed
updated footer
1 parent 3937d60 commit a29ca6b

2 files changed

Lines changed: 30 additions & 14 deletions

File tree

_config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ repository: moneuron/moneuron.github.io
6666
remote_theme: moneuron/modern-resume-theme
6767

6868
footer: |
69-
<sub>CITED BY</sub>
69+
<sub class="citations">- CITED BY: -</sub>
7070
7171
sass:
7272
sass_dir: _sass

assets/script.js

Lines changed: 29 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,35 @@ document.addEventListener("DOMContentLoaded", () => {
33
papers.forEach((paper, index) => {
44
paper.style.animationDelay = `${index * 0.25}s`;
55
});
6-
});
76

8-
document.querySelectorAll('.citation[data-doi]').forEach(el => {
9-
const doi = el.getAttribute('data-doi');
7+
const citationElements = document.querySelectorAll('.citation[data-doi]');
8+
const totalDisplay = document.querySelector('.citations');
109

11-
const url = `https://api.crossref.org/works/${encodeURIComponent(doi)}`;
12-
fetch(url)
13-
.then(res => res.json())
14-
.then(data => {
15-
const count = data.message['is-referenced-by-count'];
16-
el.textContent = `- CITATIONS: ${count} -`;
17-
})
18-
.catch(() => {
19-
el.textContent = '';
20-
});
10+
let totalCitations = 0;
11+
let completedRequests = 0;
12+
13+
citationElements.forEach(el => {
14+
const doi = el.getAttribute('data-doi');
15+
const url = `https://api.crossref.org/works/${encodeURIComponent(doi)}`;
16+
17+
fetch(url)
18+
.then(res => res.json())
19+
.then(data => {
20+
const count = data.message['is-referenced-by-count'] || 0;
21+
22+
totalCitations += count;
23+
el.textContent = `- CITATIONS: ${count} -`;
24+
})
25+
.catch(() => {
26+
el.textContent = '';
27+
})
28+
.finally(() => {
29+
completedRequests++;
30+
31+
// When all DOIs are processed, update total
32+
if (completedRequests === citationElements.length && totalDisplay) {
33+
totalDisplay.textContent = `- CITED BY: ${totalCitations} -`;
34+
}
35+
});
36+
});
2137
});

0 commit comments

Comments
 (0)