Skip to content

Commit 2d0d7ad

Browse files
committed
fix: Made style switching buttons work again
1 parent 402db23 commit 2d0d7ad

5 files changed

Lines changed: 13 additions & 14 deletions

File tree

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](http://keepachangelog.com/)
66
and this project adheres to [Semantic Versioning](http://semver.org/).
77

8+
## v5.4.1 - 2025-03-14
9+
* Fixed style switching buttons
10+
811
## v5.4.0 - 2025-03-14
912
* Added position label
1013
* Added summary text for staff & senior engineer positions

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "cv"
3-
version = "5.4.0"
3+
version = "5.4.1"
44
description = "Tools for building career documents."
55
readme = "README.md"
66
requires-python = ">=3.13"

src/app/constants.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ def emoji(cls) -> str:
2323
pass
2424

2525
def js(self) -> str:
26-
return f"replaceStyle({self}, {self.label()})"
26+
return f"replaceStyle('{self}', '{self.label()}')"
2727

2828

2929
class ColorScheme(HtmlChoices):
@@ -63,9 +63,6 @@ def label(cls) -> str:
6363
def emoji(cls) -> str:
6464
return "🔍"
6565

66-
def js(self) -> str:
67-
return f"replaceStyle({self}, {self.label()})"
68-
6966

7067
class Position(HtmlChoices):
7168
manager = auto()

static/js/switchers.js

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,21 @@ const titles = {
1111
}
1212
}
1313

14-
window.onload = () => {
14+
const getSummary = () => {
1515
var sumElement = document.getElementById("summary")
1616
children = sumElement.children
17+
var summary = "<i>Couldn't find default summary!<i>"
1718
Array.from(children).forEach((child) => {
1819
if (child.tagName === "P") {
1920
text = child.innerHTML
20-
console.log("Setting default summary")
21-
localStorage.setItem("defaultSummary", child.innerHTML)
21+
console.log("Found and saved default summary")
22+
summary = child.innerHTML
2223
}
2324
});
25+
return summary
2426
}
2527

28+
const defaultSummary = getSummary();
2629
const head = document.getElementsByTagName('head')[0];
2730

2831
const replaceStyle = (name, label) => {
@@ -48,11 +51,7 @@ const changePosition = (key) => {
4851
var summaryText = titles[key].summary
4952
if (!summaryText) {
5053
console.log("Using default summary")
51-
summaryText = localStorage.getItem("defaultSummary");
52-
}
53-
if (!summaryText) {
54-
console.log("No default summary found")
55-
summaryText = "<i>Couldn't load default summary from local storage. Please refresh page<i>"
54+
summaryText = defaultSummary;
5655
}
5756
posElement.innerHTML = titles[key].position
5857
sumElement.innerHTML = `<p>${summaryText}</p>`

uv.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)