From a7c2ee00221d9cf6c3e24a039a23cf5e8d80ce74 Mon Sep 17 00:00:00 2001 From: Neale Pickett Date: Mon, 1 Apr 2024 17:06:29 -0600 Subject: [PATCH] Better structured theme config --- theme/config.json | 7 +++++-- theme/index.mjs | 6 +++--- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/theme/config.json b/theme/config.json index 4605a27..bfd895a 100644 --- a/theme/config.json +++ b/theme/config.json @@ -1,6 +1,9 @@ { - "TrackSolved": true, - "Titles": false, + "PuzzleList": { + "TrackSolved": true, + "Titles": false, + "": 0 + }, "Puzzle": { "SyntaxHighlighting": true, "": 0 diff --git a/theme/index.mjs b/theme/index.mjs index e9f80cc..923b020 100644 --- a/theme/index.mjs +++ b/theme/index.mjs @@ -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) } }