From 62196dd238cb19d2e2c1aaa68b675f91c0c77742 Mon Sep 17 00:00:00 2001 From: Sashank999 Date: Tue, 9 Jul 2024 20:39:20 +0530 Subject: [PATCH] Fix Disable Gym Stats when switching gyms. --- extension/changelog.json | 7 ++++++- .../features/gym-disable-stats/ttGymDisableStats.js | 4 ++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/extension/changelog.json b/extension/changelog.json index 94f042b30..2a6219232 100644 --- a/extension/changelog.json +++ b/extension/changelog.json @@ -3,7 +3,12 @@ "version": { "major": 7, "minor": 4, "build": 0 }, "title": "Beta", "date": false, - "logs": { "features": [], "fixes": [], "changes": [], "removed": [] } + "logs": { + "features": [], + "fixes": [{ "message": "Fix Disable Gym Stats when switching gyms.", "contributor": "TheFoxMan" }], + "changes": [], + "removed": [] + } }, { "version": { "major": 7, "minor": 3, "build": 1 }, diff --git a/extension/scripts/features/gym-disable-stats/ttGymDisableStats.js b/extension/scripts/features/gym-disable-stats/ttGymDisableStats.js index 6848b5ebf..f6d9d0cb1 100644 --- a/extension/scripts/features/gym-disable-stats/ttGymDisableStats.js +++ b/extension/scripts/features/gym-disable-stats/ttGymDisableStats.js @@ -44,7 +44,7 @@ new MutationObserver(async (mutations) => { if (!feature.enabled()) return; - if (mutations.some((mutation) => [...mutation?.addedNodes].some((node) => node.className.includes("gymContentWrapper__")))) { + if (mutations.some((mutation) => [...mutation?.addedNodes].some((node) => node.className.includes?.("gymContentWrapper__")))) { showCheckboxes(); requireElement("#gymroot ul[class*='properties_']").then((properties) => { @@ -58,7 +58,7 @@ async function showCheckboxes() { await sleep(); - const properties = await requireElement("#gymroot ul[class*='properties___']"); + const properties = (await requireElement("#gymroot ul[class*='properties___'] [class*='strength___']")).closest("#gymroot ul[class*='properties___']"); for (const stat of properties.findAll(":scope > li:not([class*='locked___']):not(.tt-modified)")) { stat.classList.add("tt-modified");