diff --git a/extension/changelog.json b/extension/changelog.json index c6317accb..30050d4d4 100644 --- a/extension/changelog.json +++ b/extension/changelog.json @@ -5,7 +5,10 @@ "date": false, "logs": { "features": [], - "fixes": [{ "message": "Copy Post for Discord not working due to layout changes.", "contributor": "TheFoxMan" }], + "fixes": [ + { "message": "Copy Post for Discord not working due to layout changes.", "contributor": "TheFoxMan" }, + { "message": "Fixed a race condition breaking the Gym Graph on Firefox", "contributor": "Kwack" } + ], "changes": [], "removed": [] } diff --git a/extension/scripts/features/gym-graph/ttGymGraph.js b/extension/scripts/features/gym-graph/ttGymGraph.js index 5674cc167..7147eed69 100644 --- a/extension/scripts/features/gym-graph/ttGymGraph.js +++ b/extension/scripts/features/gym-graph/ttGymGraph.js @@ -132,13 +132,13 @@ const gymChart = createChart(); // If Torn dark mode is toggled. - document.find("#dark-mode-state").addEventListener("change", (event) => { + await requireElement("#dark-mode-state").then((el) => el.addEventListener("change", (event) => { const color = event.target.checked ? "#fff" : "#000"; gymChart.options.scales.x.ticks.color = color; gymChart.options.scales.y.ticks.color = color; gymChart.options.plugins.legend.labels.color = color; gymChart.update(); - }); + })); showLoadingPlaceholder(wrapper, false);