Skip to content

Commit 12e7179

Browse files
authored
Merge pull request #1780 from Shashank-Tripathi-07/fix/site-dark-mode-and-instructors-audit
Dark mode for nav-footer, dropdown-menu, and star-history iframe. Uses body.quarto-dark selectors and MutationObserver for the star-history theme swap.
2 parents f55a9a1 + a4dba56 commit 12e7179

1 file changed

Lines changed: 23 additions & 5 deletions

File tree

site/about/index.qmd

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,12 +63,30 @@ It started with one course at one university in 2020. Within two years, ten univ
6363
```{=html}
6464
<div style="text-align: center; margin: 1.5rem 0 2rem; background: var(--ab-card-bg); border: 1px solid var(--ab-border); border-radius: 12px; padding: 1.5rem;">
6565
<a href="https://www.star-history.com/?repos=harvard-edge%2Fcs249r_book&type=date&legend=top-left" target="_blank" rel="noopener">
66-
<picture>
67-
<source media="(prefers-color-scheme: dark)" srcset="https://api.star-history.com/image?repos=harvard-edge/cs249r_book&type=date&theme=dark&legend=top-left" />
68-
<source media="(prefers-color-scheme: light)" srcset="https://api.star-history.com/image?repos=harvard-edge/cs249r_book&type=date&legend=top-left" />
69-
<img src="https://api.star-history.com/image?repos=harvard-edge/cs249r_book&type=date&legend=top-left" alt="GitHub star growth chart showing adoption over time" style="max-width: 550px; width: 100%; border-radius: 6px;" loading="lazy" />
70-
</picture>
66+
<img id="star-history-img"
67+
src="https://api.star-history.com/image?repos=harvard-edge/cs249r_book&type=date&legend=top-left"
68+
alt="GitHub star growth chart showing adoption over time"
69+
style="max-width: 550px; width: 100%; border-radius: 6px;"
70+
loading="lazy" />
7171
</a>
72+
<script>
73+
(function () {
74+
var DARK_SRC = "https://api.star-history.com/image?repos=harvard-edge/cs249r_book&type=date&theme=dark&legend=top-left";
75+
var LIGHT_SRC = "https://api.star-history.com/image?repos=harvard-edge/cs249r_book&type=date&legend=top-left";
76+
var img = document.getElementById("star-history-img");
77+
function syncSrc() {
78+
if (!img) return;
79+
img.src = document.body.classList.contains("quarto-dark") ? DARK_SRC : LIGHT_SRC;
80+
}
81+
syncSrc();
82+
var observer = new MutationObserver(function (mutations) {
83+
mutations.forEach(function (m) {
84+
if (m.attributeName === "class") syncSrc();
85+
});
86+
});
87+
observer.observe(document.body, { attributes: true, attributeFilter: ["class"] });
88+
})();
89+
</script>
7290
<p style="color: var(--ab-text-muted); font-size: 0.85rem; margin: 1rem 0 0;">Everything here is free — our only ask is a <a href="https://github.com/harvard-edge/cs249r_book" target="_blank" rel="noopener" style="color: var(--ab-accent); font-weight: 600;">⭐ star on GitHub</a>. It tells universities, publishers, and funders that AI engineering education matters.</p>
7391
</div>
7492
</div>

0 commit comments

Comments
 (0)