Merge pull request #9 from barrett-ruth/fix/mobile

color git repos properly
This commit is contained in:
Barrett Ruth 2025-11-10 01:08:16 -05:00 committed by GitHub
commit 1867445a47
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -136,13 +136,27 @@
const delay = 500;
const colorFn = window.getTopicColor || (() => "");
document.querySelectorAll("[data-topic]").forEach((t) => {
t.classList.remove("active");
t.style.color = "";
});
link.classList.add("active");
const c = colorFn(topic);
if (c) link.style.color = c;
const topicKey = topic.split("/")[0];
const willNavigateAway = !(
isHome &&
topic &&
window.postsByCategory &&
window.postsByCategory[topic]
);
if (willNavigateAway) {
link.classList.add("active");
const c = colorFn(topicKey);
if (c) link.style.color = c;
} else {
document.querySelectorAll("[data-topic]").forEach((t) => {
t.classList.remove("active");
t.style.color = "";
});
link.classList.add("active");
const c = colorFn(topicKey);
if (c) link.style.color = c;
}
const displayPath = isHome ? `/${topic}` : displayPathFromHref(href);