feat(index): underline posts
This commit is contained in:
parent
778ac93e92
commit
f5637b9297
1 changed files with 12 additions and 12 deletions
|
|
@ -46,6 +46,8 @@ function renderPosts(topic) {
|
||||||
link.href = postLink ? `/posts/${postLink}.html` : `/wip.html`;
|
link.href = postLink ? `/posts/${postLink}.html` : `/wip.html`;
|
||||||
link.textContent = postName;
|
link.textContent = postName;
|
||||||
|
|
||||||
|
link.style.textDecoration = "underline";
|
||||||
|
|
||||||
post.appendChild(link);
|
post.appendChild(link);
|
||||||
posts.appendChild(post);
|
posts.appendChild(post);
|
||||||
});
|
});
|
||||||
|
|
@ -86,20 +88,16 @@ window.addEventListener("beforeunload", () => {
|
||||||
document.querySelector(".terminal-prompt").innerHTML = TERMINAL_PROMPT;
|
document.querySelector(".terminal-prompt").innerHTML = TERMINAL_PROMPT;
|
||||||
});
|
});
|
||||||
|
|
||||||
function applyColor(topic) {
|
function getTopicColor(topicName) {
|
||||||
switch (topic.parentElement.className.split(" ")[1]) {
|
switch (topicName) {
|
||||||
case "software":
|
case "software":
|
||||||
topic.style.color = "#0073e6";
|
return "#0073e6";
|
||||||
break;
|
|
||||||
case "economics":
|
case "economics":
|
||||||
topic.style.color = "#009975";
|
return "#009975";
|
||||||
break;
|
|
||||||
case "trading":
|
case "trading":
|
||||||
topic.style.color = "#d50032";
|
return "#d50032";
|
||||||
break;
|
|
||||||
case "algorithms":
|
case "algorithms":
|
||||||
topic.style.color = "#6a0dad";
|
return "#6a0dad";
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -107,8 +105,10 @@ document.addEventListener("DOMContentLoaded", function () {
|
||||||
const topics = document.querySelectorAll(".topic a");
|
const topics = document.querySelectorAll(".topic a");
|
||||||
|
|
||||||
topics.forEach((topic) => {
|
topics.forEach((topic) => {
|
||||||
|
const topicName = topic.parentElement.className.split(" ")[1];
|
||||||
|
|
||||||
topic.addEventListener("mouseenter", () => {
|
topic.addEventListener("mouseenter", () => {
|
||||||
applyColor(topic);
|
topic.style.color = getTopicColor(topicName);
|
||||||
});
|
});
|
||||||
|
|
||||||
topic.addEventListener("mouseleave", () => {
|
topic.addEventListener("mouseleave", () => {
|
||||||
|
|
@ -129,7 +129,7 @@ document.addEventListener("DOMContentLoaded", function () {
|
||||||
|
|
||||||
topic.classList.add("active");
|
topic.classList.add("active");
|
||||||
document.getElementById("posts").innerHTML = "";
|
document.getElementById("posts").innerHTML = "";
|
||||||
applyColor(topic);
|
topic.style.color = getTopicColor(topicName);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue