From e9c2f854a703ab85bfac4ce81c8a370e7dd10a87 Mon Sep 17 00:00:00 2001 From: Sashank999 Date: Tue, 25 Jun 2024 19:53:41 +0530 Subject: [PATCH] Revert racing features fixes. URL change is reverted. This reverts commits 9656832fd712adbc00f9d89bf03a53a5ad4a452c and faa2a39f054ea55c326860b0447196f18b9fb116. # Conflicts: # extension/changelog.json --- extension/changelog.json | 2 +- extension/manifest.json | 4 ++-- .../features/car-win-percentage/ttCarWinPercentage.js | 2 +- .../scripts/features/racing-upgrades/ttRacingUpgrades.js | 6 +++--- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/extension/changelog.json b/extension/changelog.json index d1514daf3..04c9788e7 100644 --- a/extension/changelog.json +++ b/extension/changelog.json @@ -5,7 +5,7 @@ "date": false, "logs": { "features": [{ "message": "Show total value of an opened supply pack.", "contributor": "Conrado" }], - "fixes": [{ "message": "Fixing racing features.", "contributor": "TheFoxMan" }], + "fixes": [{ "message": "Fixing (and then reverting) racing features.", "contributor": "TheFoxMan" }], "changes": [], "removed": [] } diff --git a/extension/manifest.json b/extension/manifest.json index 5e87a20f3..cd1d579a9 100644 --- a/extension/manifest.json +++ b/extension/manifest.json @@ -1,7 +1,7 @@ { "manifest_version": 3, "name": "TornTools", - "version": "7.2.4", + "version": "7.3.0", "description": "Several tools for Torn.", "icons": { "16": "resources/images/icon_16.png", "48": "resources/images/icon_48.png", "128": "resources/images/icon_128.png" }, "action": { "default_title": "TornTools", "default_popup": "pages/popup/popup.html", "default_icon": "resources/images/icon_128.png" }, @@ -611,7 +611,7 @@ "run_at": "document_end" }, { - "matches": ["https://www.torn.com/loader.php?sid=racing*", "https://www.torn.com/page.php?sid=racing*"], + "matches": ["https://www.torn.com/loader.php?sid=racing*"], "css": ["scripts/features/racing-upgrades/ttRacingUpgrades.css"], "js": ["scripts/features/car-win-percentage/ttCarWinPercentage.js", "scripts/features/racing-upgrades/ttRacingUpgrades.js"], "run_at": "document_end" diff --git a/extension/scripts/features/car-win-percentage/ttCarWinPercentage.js b/extension/scripts/features/car-win-percentage/ttCarWinPercentage.js index d656c294b..3ced0fef7 100644 --- a/extension/scripts/features/car-win-percentage/ttCarWinPercentage.js +++ b/extension/scripts/features/car-win-percentage/ttCarWinPercentage.js @@ -20,7 +20,7 @@ addXHRListener(({ detail: { page, xhr } }) => { if ( feature.enabled() && - (page === "loader" || page === "page") && + page === "loader" && (xhr.responseURL.includes("tab=parts") || xhr.responseURL.includes("tab=cars") || xhr.responseURL.includes("race_carlist.js")) ) addPercentage(); diff --git a/extension/scripts/features/racing-upgrades/ttRacingUpgrades.js b/extension/scripts/features/racing-upgrades/ttRacingUpgrades.js index b9c4e5cf5..f2d4dccb7 100644 --- a/extension/scripts/features/racing-upgrades/ttRacingUpgrades.js +++ b/extension/scripts/features/racing-upgrades/ttRacingUpgrades.js @@ -20,7 +20,7 @@ addXHRListener(async ({ detail: { page, xhr, uri } }) => { if (!feature.enabled()) return; - if ((page === "page" || page === "loader") && uri) { + if (page === "loader" && uri) { const sid = uri.sid; if (sid !== "racing") return; @@ -33,7 +33,7 @@ car.classList.add("tt-modified"); car.addEventListener("click", () => requireElement(".pm-categories-wrap").then(showUpgrades)); } - } else if (page === "page" || page === "loader2") { + } else if (page === "loader2") { const params = new URLSearchParams(xhr.requestBody); const sid = params.get("sid"); @@ -45,7 +45,7 @@ const confirm = params.get("confirm"); if (confirm !== "1") return; - setTimeout(resetUpgrades, 1000); + setTimeout(resetUpgrades, 250); } }); }