feat: color
This commit is contained in:
parent
285f0ef1e0
commit
000e644c6b
4 changed files with 27 additions and 13 deletions
|
|
@ -204,19 +204,22 @@
|
||||||
|
|
||||||
document.body.addEventListener("click", (e) => {
|
document.body.addEventListener("click", (e) => {
|
||||||
if (e.target.closest(".home-link")) return handleHomeClick(e);
|
if (e.target.closest(".home-link")) return handleHomeClick(e);
|
||||||
if (e.target.closest("[data-topic]")) return handleDataTopicClick(e);
|
if (e.target.closest(".topics [data-topic]"))
|
||||||
|
return handleDataTopicClick(e);
|
||||||
});
|
});
|
||||||
|
|
||||||
document.body.addEventListener(
|
document.body.addEventListener(
|
||||||
"mouseenter",
|
"mouseenter",
|
||||||
(e) => {
|
(e) => {
|
||||||
const link = e.target.closest("[data-topic]");
|
const link = e.target.closest(".topics [data-topic]");
|
||||||
if (!link) return;
|
if (!link) return;
|
||||||
const color =
|
const raw = link.dataset.topic || "";
|
||||||
(window.getTopicColor &&
|
const key = raw.split("/")[0].toLowerCase();
|
||||||
window.getTopicColor(link.dataset.topic?.toLowerCase() || "")) ||
|
const color = (window.getTopicColor && window.getTopicColor(key)) || "";
|
||||||
"";
|
if (color) {
|
||||||
if (color) link.style.color = color;
|
link.style.color = color;
|
||||||
|
link.style.textDecorationColor = color;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
true,
|
true,
|
||||||
);
|
);
|
||||||
|
|
@ -224,9 +227,12 @@
|
||||||
document.body.addEventListener(
|
document.body.addEventListener(
|
||||||
"mouseleave",
|
"mouseleave",
|
||||||
(e) => {
|
(e) => {
|
||||||
const link = e.target.closest("[data-topic]");
|
const link = e.target.closest(".topics [data-topic]");
|
||||||
if (!link) return;
|
if (!link) return;
|
||||||
if (!link.classList.contains("active")) link.style.color = "";
|
if (!link.classList.contains("active")) {
|
||||||
|
link.style.color = "";
|
||||||
|
link.style.textDecorationColor = "";
|
||||||
|
}
|
||||||
},
|
},
|
||||||
true,
|
true,
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,9 @@ date: "30/07/2024"
|
||||||
useKatex: true
|
useKatex: true
|
||||||
---
|
---
|
||||||
|
|
||||||
|
import { Code } from 'astro:components';
|
||||||
|
|
||||||
|
|
||||||
# context
|
# context
|
||||||
|
|
||||||
While working for [TRB Capital Management](https://trbcap.com/), certain strategies necessitated finding the minimum and maximum of a moving window of prices.
|
While working for [TRB Capital Management](https://trbcap.com/), certain strategies necessitated finding the minimum and maximum of a moving window of prices.
|
||||||
|
|
@ -12,6 +15,7 @@ While working for [TRB Capital Management](https://trbcap.com/), certain strateg
|
||||||
|
|
||||||
Design a data structure supporting the following operations:
|
Design a data structure supporting the following operations:
|
||||||
|
|
||||||
|
|
||||||
- `build(size_t capacity)` : initialize the data structure with capacity/window size `capacity`
|
- `build(size_t capacity)` : initialize the data structure with capacity/window size `capacity`
|
||||||
The data structure must always hold $\leq$ `capacity` prices.
|
The data structure must always hold $\leq$ `capacity` prices.
|
||||||
- `void push_back(double value)`
|
- `void push_back(double value)`
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@ const {
|
||||||
<Footer />
|
<Footer />
|
||||||
<script is:inline>
|
<script is:inline>
|
||||||
window.getTopicColor = function (topicName) {
|
window.getTopicColor = function (topicName) {
|
||||||
switch (topicName) {
|
switch ((topicName || "").toLowerCase()) {
|
||||||
case "software":
|
case "software":
|
||||||
return "#0073e6";
|
return "#0073e6";
|
||||||
case "algorithms":
|
case "algorithms":
|
||||||
|
|
@ -37,7 +37,9 @@ const {
|
||||||
case "meditations":
|
case "meditations":
|
||||||
return "#6a0dad";
|
return "#6a0dad";
|
||||||
case "autonomous-racing":
|
case "autonomous-racing":
|
||||||
return "#009975";
|
return "#3d8a44";
|
||||||
|
case "git":
|
||||||
|
return "#e67300";
|
||||||
default:
|
default:
|
||||||
return "#000000";
|
return "#000000";
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
export function getTopicColor(topicName) {
|
export function getTopicColor(topicName) {
|
||||||
switch (topicName) {
|
switch ((topicName || "").toLowerCase()) {
|
||||||
case "software":
|
case "software":
|
||||||
return "#0073e6";
|
return "#0073e6";
|
||||||
case "algorithms":
|
case "algorithms":
|
||||||
|
|
@ -7,7 +7,9 @@ export function getTopicColor(topicName) {
|
||||||
case "meditations":
|
case "meditations":
|
||||||
return "#6a0dad";
|
return "#6a0dad";
|
||||||
case "autonomous-racing":
|
case "autonomous-racing":
|
||||||
return "#009975";
|
return "#3d8a44";
|
||||||
|
case "git":
|
||||||
|
return "#e67300";
|
||||||
default:
|
default:
|
||||||
return "#000000";
|
return "#000000";
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue