Better structured theme config

This commit is contained in:
Neale Pickett 2024-04-01 17:06:29 -06:00
parent 2f7fba2dff
commit a7c2ee0022
2 changed files with 8 additions and 5 deletions

View File

@ -1,6 +1,9 @@
{
"PuzzleList": {
"TrackSolved": true,
"Titles": false,
"": 0
},
"Puzzle": {
"SyntaxHighlighting": true,
"": 0

View File

@ -88,7 +88,7 @@ class App {
// Update elements with data-track-solved
for (let e of document.querySelectorAll("[data-track-solved]")) {
// Only display if data-track-solved is the same as config.trackSolved
e.classList.toggle("hidden", common.Truthy(e.dataset.trackSolved) != this.config.TrackSolved)
e.classList.toggle("hidden", common.Truthy(e.dataset.trackSolved) != this.config.PuzzleList?.TrackSolved)
}
for (let e of document.querySelectorAll(".login")) {
@ -152,10 +152,10 @@ class App {
a.href = url
a.target = "_blank"
if (this.config.TrackSolved) {
if (this.config.PuzzleList?.TrackSolved) {
a.classList.toggle("solved", this.state.IsSolved(puzzle))
}
if (this.config.Titles) {
if (this.config.PuzzleList?.Titles) {
this.loadTitle(puzzle, i)
}
}