Skip to content

Commit 37896e3

Browse files
committed
Sync small changes
1 parent 4f07f61 commit 37896e3

File tree

5 files changed

+107
-32
lines changed

5 files changed

+107
-32
lines changed

assets/css/custom.css

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -452,6 +452,8 @@
452452
height: auto;
453453
}
454454

455+
/* Consistent sizing for all logos - remove Intel-specific rule */
456+
455457
/* GitHub-style Repository Cards */
456458
.github-repos {
457459
display: grid;
@@ -633,12 +635,17 @@
633635
gap: 12px;
634636
}
635637

636-
.sponsor-grid {
637-
grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
638-
gap: 0.5rem;
639-
}
640-
641-
.github-repos {
642-
grid-template-columns: 1fr;
643-
}
638+
.sponsor-grid {
639+
grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
640+
gap: 0.5rem;
641+
}
642+
643+
.sponsor-item img {
644+
max-width: 140px;
645+
max-height: 55px;
646+
}
647+
648+
.github-repos {
649+
grid-template-columns: 1fr;
650+
}
644651
}

assets/js/github-stats.js

Lines changed: 64 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// GitHub Stats Fetcher
2-
// Automatically fetches star and fork counts from GitHub API
2+
// Loads stats only when open-source section is clicked
33

44
document.addEventListener('DOMContentLoaded', function() {
55
// GitHub API endpoint (no authentication required for public repos)
@@ -15,11 +15,42 @@ document.addEventListener('DOMContentLoaded', function() {
1515
{ name: 'moatlab/IODA-SOSP21-AE', elementId: 'ioda-stats' }
1616
];
1717

18-
// Fetch stats for each repository
19-
repos.forEach(repo => {
20-
fetchRepoStats(repo.name, repo.elementId);
18+
let statsLoaded = false;
19+
20+
// Function to load GitHub stats
21+
function loadGitHubStats() {
22+
if (statsLoaded) return; // Only load once
23+
24+
console.log('Loading GitHub stats...');
25+
statsLoaded = true;
26+
27+
// Fetch stats for each repository
28+
repos.forEach(repo => {
29+
fetchRepoStats(repo.name, repo.elementId);
30+
});
31+
}
32+
33+
// Listen for clicks on the open-source section
34+
document.addEventListener('click', function(event) {
35+
// Check if the click is on or within the open-source section
36+
const target = event.target;
37+
const openSourceSection = target.closest('.github-repos') ||
38+
target.closest('[href*="opensource"]') ||
39+
target.closest('[href*="open-source"]');
40+
41+
if (openSourceSection) {
42+
// Small delay to ensure the section is fully loaded
43+
setTimeout(loadGitHubStats, 100);
44+
}
2145
});
2246

47+
// Also listen for navigation to the open-source page
48+
if (window.location.pathname.includes('opensource') ||
49+
window.location.pathname.includes('open-source')) {
50+
// If we're already on the open-source page, load stats after a short delay
51+
setTimeout(loadGitHubStats, 500);
52+
}
53+
2354
async function fetchRepoStats(repoName, elementId) {
2455
try {
2556
const response = await fetch(`${GITHUB_API_BASE}/${repoName}`);
@@ -40,20 +71,35 @@ document.addEventListener('DOMContentLoaded', function() {
4071
function updateStatsDisplay(elementId, stars, forks) {
4172
const element = document.getElementById(elementId);
4273
if (element) {
43-
element.innerHTML = `
44-
<span class="repo-stars">
45-
<svg width="16" height="16" viewBox="0 0 16 16" fill="currentColor">
46-
<path d="M8 .25a.75.75 0 0 1 .673.418l3.058 6.197 6.839.994a.75.75 0 0 1 .415 1.279l-4.948 4.823 1.168 6.811a.75.75 0 0 1-1.088.791L8 14.347l-6.116 3.216a.75.75 0 0 1-1.088-.79l1.168-6.812-4.948-4.823a.75.75 0 0 1 .415-1.28l6.838-.993L7.327.668A.75.75 0 0 1 8 .25Z"/>
47-
</svg>
48-
${stars}
49-
</span>
50-
<span class="repo-forks">
51-
<svg width="16" height="16" viewBox="0 0 16 16" fill="currentColor">
52-
<path d="M5 5.372v.878c0 .414.336.75.75.75h4.5a.75.75 0 0 0 .75-.75v-.878a2.25 2.25 0 1 1 1.5 0v.878a2.25 2.25 0 0 1-2.25 2.25h-1.5v2.128a2.251 2.251 0 1 1-1.5 0V8.5h-1.5A2.25 2.25 0 0 1 3.5 6.25v-.878a2.25 2.25 0 1 1 1.5 0ZM5 3.25a.75.75 0 1 0-1.5 0 .75.75 0 0 0 1.5 0Zm6.75.75a.75.75 0 1 0 0-1.5.75.75 0 0 0 0 1.5Zm-3 8.75a.75.75 0 1 0-1.5 0 .75.75 0 0 0 1.5 0Z"/>
53-
</svg>
54-
${forks}
55-
</span>
56-
`;
74+
// Find the existing star and fork spans
75+
const starSpan = element.querySelector('.repo-stars');
76+
const forkSpan = element.querySelector('.repo-forks');
77+
78+
if (starSpan) {
79+
// Get all child nodes
80+
const childNodes = Array.from(starSpan.childNodes);
81+
82+
// Find the text node (should be the last one)
83+
const textNode = childNodes.find(node => node.nodeType === Node.TEXT_NODE);
84+
85+
if (textNode) {
86+
// Update only the text content
87+
textNode.textContent = ` ${stars}`;
88+
}
89+
}
90+
91+
if (forkSpan) {
92+
// Get all child nodes
93+
const childNodes = Array.from(forkSpan.childNodes);
94+
95+
// Find the text node (should be the last one)
96+
const textNode = childNodes.find(node => node.nodeType === Node.TEXT_NODE);
97+
98+
if (textNode) {
99+
// Update only the text content
100+
textNode.textContent = ` ${forks}`;
101+
}
102+
}
57103
}
58104
}
59105
});

content/opensource/_index.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,4 +206,20 @@ Our research group develops and maintains several open-source software projects
206206

207207
</div>
208208

209+
<script>
210+
// Dynamically load GitHub stats JavaScript when this page is accessed
211+
document.addEventListener('DOMContentLoaded', function() {
212+
// Load the GitHub stats script dynamically
213+
const script = document.createElement('script');
214+
script.src = '/js/github-stats.js';
215+
script.onload = function() {
216+
console.log('GitHub stats script loaded successfully');
217+
};
218+
script.onerror = function() {
219+
console.error('Failed to load GitHub stats script');
220+
};
221+
document.head.appendChild(script);
222+
});
223+
</script>
224+
209225

content/sponsors/_index.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,16 @@
22
description: "Our research sponsors and partners"
33
---
44

5+
<!-- Preload critical sponsor logos with higher priority -->
6+
<link rel="preload" as="image" href="/sponsors/nsf-logo.svg" fetchpriority="high">
7+
<link rel="preload" as="image" href="/sponsors/google-logo.svg">
8+
<link rel="preload" as="image" href="/sponsors/microsoft-logo.svg">
9+
510
<p>We are grateful for the support from our research sponsors and partners.</p>
611

712
<div class="sponsor-grid">
813
<div class="sponsor-item">
9-
<img src="/sponsors/nsf-logo.svg" alt="National Science Foundation" class="sponsor-logo" loading="lazy">
14+
<img src="/sponsors/nsf-logo.svg" alt="National Science Foundation" class="sponsor-logo" loading="eager">
1015
</div>
1116
<div class="sponsor-item">
1217
<img src="/sponsors/samsung-logo.svg" alt="Samsung Electronics" class="sponsor-logo" loading="lazy">

layouts/partials/custom_head.html

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,9 @@
1010
<script src="{{ $year_grouping_js.RelPermalink }}" defer></script>
1111
{{ end }}
1212

13-
{{ $github_stats_js := resources.Get "js/github-stats.js" }}
14-
{{ if $github_stats_js }}
15-
{{ $github_stats_js := $github_stats_js | resources.Minify }}
16-
<script src="{{ $github_stats_js.RelPermalink }}" defer></script>
17-
{{ end }}
13+
{{/* GitHub stats JS is loaded dynamically when open-source section is clicked */}}
14+
{{/* $github_stats_js := resources.Get "js/github-stats.js" */}}
15+
{{/* if $github_stats_js */}}
16+
{{/* $github_stats_js := $github_stats_js | resources.Minify */}}
17+
{{/* <script src="{{ $github_stats_js.RelPermalink }}" defer></script> */}}
18+
{{/* end */}}

0 commit comments

Comments
 (0)