From 255563f2678c8026afd7c61f95b1006a7bde9833 Mon Sep 17 00:00:00 2001 From: Barrett Ruth Date: Wed, 2 Apr 2025 14:45:33 -0400 Subject: [PATCH] feat: misc cleanups --- about.html | 11 ++++++++--- scripts/common.js | 8 +++++++- scripts/post.js | 10 +++++----- styles/post.css | 2 +- 4 files changed, 21 insertions(+), 10 deletions(-) diff --git a/about.html b/about.html index 7ffff6b..74e98ec 100644 --- a/about.html +++ b/about.html @@ -12,7 +12,11 @@
- + - - + + + diff --git a/scripts/common.js b/scripts/common.js index bd08f6f..545a804 100644 --- a/scripts/common.js +++ b/scripts/common.js @@ -39,7 +39,13 @@ const getTopicColor = (topicName) => { return "#d50032"; case "algorithms": return "#6a0dad"; + default: + return "#000000"; } }; -const urlToTopic = () => window.location.pathname.split("/")[2]; +const urlToTopic = () => { + const pathname = window.location.pathname.split("/"); + if (pathname.length < 3) return "DNE"; + return pathname[2]; +}; diff --git a/scripts/post.js b/scripts/post.js index 85fbfae..784df23 100644 --- a/scripts/post.js +++ b/scripts/post.js @@ -1,8 +1,3 @@ -document.documentElement.style.setProperty( - "--topic-color", - getTopicColor(urlToTopic()), -); - const tagToHeader = new Map([ ["H2", "#"], ["H3", "##"], @@ -17,6 +12,11 @@ const setStyle = (h) => { }; document.addEventListener("DOMContentLoaded", () => { + document.documentElement.style.setProperty( + "--topic-color", + getTopicColor(urlToTopic()), + ); + document.querySelectorAll(".post-article h2").forEach(setStyle); document.querySelectorAll(".post-article h3").forEach(setStyle); }); diff --git a/styles/post.css b/styles/post.css index c883b7e..c8d6571 100644 --- a/styles/post.css +++ b/styles/post.css @@ -36,9 +36,9 @@ li { } .post-meta { - font-style: italic; /* space between date and title */ margin-left: 100px; + font-size: 1.3em; } .post-title {